🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
Nemokosch m: say 'herro'.match(/err/) ~~ Match.new 09:01
camelia 「」
Nemokosch I should start every day by posting it, like some "did you know" parody
my "top 3 design mistakes in Raku" goes like, in chronological order: 1. negation with junctions 2. Failure is Nil 3. smartmatch on Matches 09:04
1. I think we can eventually win this case - "we" because I think eventually this can be voted. I haven't given up on making a petition with thorough description of the situation 09:06
2. meh, it's not everyday enough. I'm still raising eyebrows over it but it's probably not worth it for anyone
3. well well... I have no words for this. For me, this is in another league. We live with the consequences (some good consequences as well) but since this isn't even documented, I simply don't consider this to be Raku, and never will. 09:11
once I know how to fix this, I will fix it myself if nobody else would 09:15
this is my "ceterum censeo" 09:23
thundergnat m: say 'herro'.match(/err/) ~~ Match 10:18
camelia True
thundergnat I'm not sure I see what the issue is. You are seeing if one specific Match instance is a "member" of another Match instance. 10:20
sortiz @Nemokosch, the common idiomatic form of Regex application is precisely using smartmatch:
m: say 'herro' ~~ /err/
camelia 「err」
Nemokosch thundergnat: Match.new is not a type object 10:21
thundergnat Correct
Nemokosch sortiz: this works for the wrong reason
thundergnat It's an instance
Nemokosch the design mistake is that Match:D ~~ Match:D is essentially an `or` 10:22
thundergnat Sort of like Auto.Thunderbird is not a member of Auto.Continental. Auto.Thunderbird is a member of Auto.
Nemokosch if we are not okay with [1, 2] ~~ [3, 4] returning [3,4], why would be okay with this? 10:23
it's exactly that behavior for Match instances
thundergnat m: say [1, 2] ~~ [3, 4]
camelia False
Nemokosch it's a hack to specifically support m// on the right handside of a smartmatch 10:24
thundergnat I'm not following your argument.
Nemokosch well, then go back and read it again please
thundergnat Not saying your wrong, just I'm not seeing the issue. 10:25
*you're
Nemokosch okay, one more try...
m: my $match-a = 'foobar'.match(/oo); my $match-b = 'terror'.match(/error/); say $match-a ~~ $match-b; 10:26
camelia ===SORRY!=== Error while compiling <tmp>
Unable to parse regex; couldn't find final '/'
at <tmp>:1
------> my $match-a = 'foobar'.match(/oo⏏); my $match-b = 'terror'.match(/error/)
expecting any of:
argument list…
Nemokosch oops syntax error
m: my $match-a = 'foobar'.match(/oo/); my $match-b = 'terror'.match(/error/); say $match-a ~~ $match-b;
camelia 「error」
Nemokosch and THIS is a nonsense
Match.ACCEPTS simply returns the instance. This goes against anything smartmatch is, only to hack around 'string' ~~ m/pattern/ 10:28
sortiz What would you expect smartmatch to do with Match at RHS? 10:29
Nemokosch if the LHS is also a match then eqvivalence check surely 10:30
thundergnat Specifically, what would you expect your above example to return? 10:30
Nemokosch False 10:31
m: say 'foo' ~~ 'bar'.match(/a/) 10:32
camelia 「a」
Nemokosch similarly, this is clearly a `False`
This behavior of Match is 1. unspecced 2. undocumented 3. only exists to support m// on the RHS of a smartmatch 10:34
not even to support //, only m// 10:35
thundergnat Ok, I can kind of see your point, but a match object isn't a string, or even a list of strings.
Nemokosch I can't see what that has to do with anything here. 10:36
Mind you, the important thing is the current behavior, not what I propose instead. 10:37
I could propose anything, it would probably better than the current `or` semantics
sortiz m: say ('foobar' ~~ /oo/) cmp ('terror' ~~ error) # Something like this? 10:38
camelia ===SORRY!=== Error while compiling <tmp>
Undeclared routine:
error used at line 1
sortiz m: say ('foobar' ~~ /oo/) cmp ('terror' ~~ /error/) # Something like this?
camelia More
Nemokosch I need to check how cmp is implemented on Match objects 10:39
but yes, that's the core idea
docs.raku.org/type/Match#infix_eqv 10:40
eqv is implemented on Match, Match:D ~~ Match:D could simply be the same as Match:D eqv Match:D
that doesn't make the string ~~ match case less hacky per se, though 10:41
thundergnat Well, the current behavior, while perhaps not awesome, doesn't really bother me; mostly due to it being 1. unspecced 2. undocumented. I can't ever remember ever wanting to smartmatch against a Match object so haven't run into the issue. Just because it doesn't bother me doesn't mean it shouldn't be improved though. 10:42
Nemokosch I understand you. These examples might bite somebody once in, say, a decade; not too often for sure 10:44
It's rather the underlying principle that the concrete use-case ("string" ~~ m/pattern/) gets to beat the general concept (smartmatching semantics)
That somebody ever thought "in order to support this paradigm, let's hack smartmatching itself" 10:45
this is a very bad Perl(5) habit 10:46
sortiz Yes, and that is the real problem.
lizmat well, sometimes Raku's roots show
personally I always use the "foo".match(/regex/) syntax rather than "foo" ~~ /regex/ 10:48
Nemokosch what happened with S///, while it might be unintended, shows that somehow it's possible to support 'string' ~~ regex:operators// on the syntax level(?) instead of hacking return types of ACCEPTS 10:49
I think the underlying problem really is that what I called "regex operators" aren't clear about what they are 10:50
I used to think they are plain syntax
now the behavior is kinda inbetween 10:51
and the intention was that they are plain values (functions executed with over-the-top precedence) 10:52
sortiz What happened with S/// is a bug in a recent optimization, that should be fixed. But, yes, it is possible to allow other ACCEPTS cases.
Nemokosch well I still think it's rather an unintended feature than a bug :) 10:53
the specification could be completed in a direction that values it as a feature 10:54
sortiz I'm empathetic with your need of a simple "topicalizer" but not a the cost of an "optional" ACCEPTS for Str :) 10:56
Nemokosch What does "optional" mean here? 10:57
sortiz That the bug is that, with S///, ACCEPTS is NOT called 10:58
Nemokosch By the way, I can see another resolution, with a breaking change: simply let's say that 'string' ~~ m/pattern/ is invalid
because in that example, smartmatch is indeed a simple "topicalizer", and this introduced the Match hack
Nemokosch sortiz: by the way, in my mind, the cost isn't the "optional ACCEPTS for Str" 11:00
you could say the cost is far greater than that
it's that "regex operators" are consistently seen as syntax, and hence syntax special-cased with smartmatching
no ACCEPTS whatsoever because no data in the first place 11:01
so basically deliberately doing what the optimization did under the hood
This is the "PR friendly but core dev unfriendly" approach 11:04
no breaking changes, slight adjustment of documentation, more syntax to take care of
the "core dev friendly but PR unfriendly" approach would be the other thing I said
"sorry but 'string' ~~ m/pattern/ is a bad idea; m// is not meant for smartmatching just like S/// and TR///" 11:05
no code added, what's more: weird Match smartmatching removed 11:06
however it's obviously a breaking change
sortiz That ship has already sailed
lizmat breaking changes could be implemented at a language level
Nemokosch I don't think this is on the "ship has sailed" level; it's too bad to be accepted 11:07
you may say "Failure is Nil" is "the ship has sailed" level but this is even worse
also, "Failure is Nil" is carefully documented while this is treated as an implementation detail to this very daY 11:08
sortiz In the "Failure is Nil" I can't see the need of a new Type only for some theoretical formality. 11:11
Nemokosch It was more than "theoretical formality" - Failure broke the semantics of Nil explicitly - but anyway 11:12
if that's a "risky decision", the Match smartmatching is, well, still a hack 11:13
lizmat: re 'string' ~~ /regex/ 11:16
I think that wouldn't be affected either way, only m// 11:17
lizmat agree
Nemokosch m: my $foo = /lol/; say 'trololo' ~~ $foo;
camelia 「lol」
Nemokosch I suppose it's a plain string ~~ regex smartmatch
lizmat m: my $foo = /lol/; say $foo.ACCEPTS('trololo') 11:18
camelia 「lol」
lizmat which would be an ACCEPTS not returning a Bool still
Nemokosch yes but I think it's conceptually well thought-out 11:19
works with given-when in a sensible manner
lizmat m: my $foo = /lol/; say $foo.ACCEPTS('trodofoo')
camelia Nil
lizmat not returning False in that context would also make sense, no ? 11:20
Nemokosch yes, I think so
and additionally gives something that makes sense outside of boolean context, with regards to string-against-regex 11:21
by the way 11:22
there is some tricky special-casing with smartmatching, isn't it? I mean affecting the topic variable 11:23
that's why the "regex operators" can read the LHS as topic, despite ~~ having lower precedence 11:24
Nemokosch which is quite surprising if you just try to parse the syntax 11:25
sortiz Yes, the "topicalization/localization" is inserted by the compiler. 11:28
Nemokosch I wouldn't be surprised if ~~ was full of undiscovered monsters 11:31
I already found something I cannot understand
m: 'trololo' ~~ 'lmao' ~~ (say 'Hey there!')
camelia ( no output )
Nemokosch it looks like the say should run first but it doesn't run at all 11:32
okay... same with `eqv`. What am I missing? 11:33
perhaps some common sense but still 11:34
are operands always evaluated lazily? 11:35
Anton Antonov <@755062053282119803> Can we discuss the bug you see here? 11:38
Nemokosch tbrowder: the id may not be telling; Anton asked you 11:40
sortiz A chain of ~~ is terminated at the first False. 11:42
Anton Antonov <@297037173541175296> Thanks! I guess I have to log in to IRC...
Nemokosch I feel you 😄
Nemokosch sortiz: oh okay thanks 11:45
antononcube tbrowder Can we discuss the bug you see in Markdown::Grammar here? 11:46
Nemokosch m: 'trololo' ~~ 'trololo' ~~ (say m/lol/) 11:48
camelia Use of uninitialized value of type Any in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to something meaningful.
Nil
in block <unit> at <tmp> line 1
Nemokosch this is also interesting. Not realistic, I know, but I wonder what happened 11:49
I expected $_ to be something at least
sortiz m: say 'trololo' ~~ /lol/ ~~ /o/ 12:01
camelia 「o」
sortiz m: 'trololo' ~~ /lol/ ~~ $_.say 12:02
camelia 「lol」
sortiz The chain is for Regexes.
tbrowder antononcube: yes. did you see my addition to the issue this morning? 12:17
antononcube tbrowder Yes -- thank you! I responded : github.com/antononcube/Raku-Markdo...1303300381 12:18
tbrowder that is strange. are you sure the fix got into your last release? 12:20
with zef i uninstalled all versions and then installed the latest 12:21
antononcube Oh! Sorry -- it is not in zef / raku.land yet. My responses are with the code in the repository. 12:22
tbrowder ah! ok, that explains it. i 12:23
antononcube I have to finish another "fix" and I will upload to raku.land. I hope that will happen within one hour.
tbrowder i'll wait for the release, and i do think the EVAL test would be useful (don't forget about the MONKEY* pragma 12:24
and don't rush for me, not in a great hurry--just glad i'm not going crazy yet! 12:26
thanks, bye
antononcube tbrowder Ok, sounds good. :) 12:29
lizmat weekly: dev.to/lizmat/dont-fear-the-grepper-6-4i
notable6 lizmat, Noted! (weekly)
Nemokosch sortiz: that's exactly what I mean by "undiscovered monsters" :) 12:31
sortiz Please remember that the documentation is a voluntary effort. :) 12:32
antononcube lizmat Another gripper article !? I liked the fact that those articles were exactly 5.
lizmat hehe... well, 6 still has a special meaning to Camelia :-) 12:33
it's still on one of her wings :-) 12:34
antononcube While studying mathematics we were told the maxim: "It is better to solve one problem in five different ways, than solve five different problems in the same way."
lizmat so who proved that 6 different ways weren't better ? :-) 12:35
at least that's the product of 2 primes!
antononcube It is a perfect number : the sum of its devisors make it. 12:37
Nemokosch sortiz: fair point about the documentation but please also keep in mind that documentation can't change a bug into a feature 12:39
lizmat
.oO(I thought that was the definition of a documented bug?)
12:40
Nemokosch I tend to refer to esoteric languages; "esoteric" doesn't mean "undocumented", yet we want to avoid that group
lizmat: only in the joke :D 12:41
Nemokosch I'm still thinking what to think about the immediate topicalization with ~~ 12:57
I wouldn't say it's a bug but it does seem like the kind of peculiarity that works against the decoupling of the Raku language and Rakudo in particular 12:58
tbrowder .tell tonyo: if you plan to close those pending fixes in CSV::Parser, i will abandon my simple csv parser. 12:59
tellable6 tbrowder, I'll pass your message to tonyo
lizmat afk& 13:00
Nemokosch tbrowder: CSV-AutoClass?
sortiz $_ is magical, all "topicalizers" are especially handled. Remember that, by default, every scope has its own $_ 13:03
Nemokosch Yes but perhaps violating the apparent syntax is a different thing 13:05
it's not that ~~ sets the topic variable, it's that it sets before its precedence 13:06
Now that you brought $_ scoping up, I have a bonus issue for you: github.com/rakudo/rakudo/issues/5004
sortiz It is set around its LHS evaluation. And yes, in Raku any "operator" can change the context of its "operands" evaluation. 13:11
Nemokosch oh you may be right, moment... 13:13
my test was probably bad
okay, my fault, it's set at a sensible moment 13:14
confer
m: 'asd' ~ '123' ~~ (say m/d1/)
camelia 「d1」
Nemokosch that is, executed after the LHS is ready
sortiz Think of 'foo ~~ bar' as 'infix:<~~>($_ = foo, bar)' but with $_ "localized" 13:15
Nemokosch one could say, it's the first step of executing ~~
and the operands are lazy 13:16
that's also an important thing
sortiz As I said in your "issue"...
Nemokosch you did say "localized" but we didn't talk about operands being lazy at all 13:17
(also you didn't check the current behavior yourself; I still feel something was missing from your side as well, regarding the communication) 13:19
sortiz Why "lazy"? All "operands" must be evaluated before the "operator", so when the RHS is evaluated the topicalizer is ready. 13:23
Nemokosch if operands were evaluated before the operator, an m// would disregard the LHS and use the original $_ 13:27
Nemokosch m: 'asd' ~ '123' ~~ (say m/d1/) 13:29
camelia 「d1」
Nemokosch this was the final proof that's not the case
sortiz m: 'asd' ~ ('123' ~~ (say m/d1/)) # Precedence? 13:32
camelia WARNINGS for <tmp>:
Nil
Useless use of "~" in expression "'asd' ~ ('123' ~~ (say m/d1/))" in sink context (line 1)
antononcube How quotes are specified in Pod6? Something like "= para Quote" or, say, "=begin quote" ... "=end" ? 13:44
sortiz m: say 1 + 2 ~~ 6 - $_ # Can be expected, no? 13:52
camelia True
Nemokosch that order of evaluation is infix? 14:13
Actually, I think the issue is exactly that it cannot be expected, not that it's absurd or anything 14:17
it's an "outsmart-match" 14:18
rir How can a unprinted comment be added to a .pod6 file in Raku/doc? 14:28
Nemokosch so you mean it doesn't generate any output? 14:36
rir @razetime, yes. 15:03
razetime is that a respose to the ⍺⍵ question?
rir @razetime, Sorry, that was misdirected. 15:04
razetime ah, ok.
rir Nemokosch> Yes.
Nemokosch docs.raku.org/language/pod#Pod6_comments 15:06
did this not work?
rir Nemokosch> Thanks, I'll get rtfming. 15:07
Nemokosch not a big POD6 expert myself :D 15:09
bisectable6: my @test = 1..*; try dd @test; $!.message.say; 15:18
bisectable6 Nemokosch, Will bisect the whole range automagically because no endpoints were provided, hang tight
Nemokosch, Output on all releases: gist.github.com/8f8c79094f8124f178...79b3715647 15:19
Nemokosch, More than 4 changes to bisect, please try a narrower range like old=2021.03 new=HEAD
Geth advent: pheix++ created pull request #96:
Update authors.md
Nemokosch bisectable6: old=2020.12 new=HEAD my @test = 1..*; try dd @test; $!.message.say; 15:21
bisectable6 Nemokosch, Bisecting by output (old=2020.12 new=c704d97) because on both starting points the exit code is 0
Nemokosch, (2021-04-01) github.com/rakudo/rakudo/commit/71...aecc4e9c8c 15:22
Nemokosch, bisect log: gist.github.com/43a064dc48b9f5a765...20795fb9a0
[Coke] git question: any idea why 'git pull --prune' would keep reporting the same branches deleted every time (and also the same new branches created), Shouldn't I be able to run this twice and basically get a silent run the second time? (yes, I'm on windows) 15:38
ah. might be due to things like branches with /Feature/branch1 vs. /feature/branch2 (part of the "path" is different-cased, even though there are no branches specifically that differ only by case. Ugh.) 15:42
Geth advent: 044e316318 | Kostas++ (committed using GitHub Web editor) | raku-advent-2022/authors.md
Update authors.md (#96)

1. pheix: Trove testing suite — yet another TAP harness
15:53
[Coke] if I have "/this/that/other" and %foo{bar}, is there an easy way to make %foo{bar}{this}{that}{other} ? 16:05
I can get to <this that other> easily, but not sure how to then approach the nested hash. 16:06
er, I mean %foo<bar><this><that><other>, of course.
Nemokosch v6.e has || 16:13
Nemokosch m: use v6.e.PREVIEW; my \bar = "lol"; my %foo; %foo<bar>{||<this that other>} = "demo"; dd %foo; 16:16
camelia Hash %foo = {:bar(${:this(${:that(${:other("demo")})})})}
Nemokosch [Coke] ^ what about this?
tbrowder Nemokosch: no, it’s unpublished, and probably not needed (CSV::Parser::Simple) 18:35
tellable6 tbrowder, I'll pass your message to Nemokosch
rir m: my %h; %h<bar> = [=>] <a b c>; 20:23
camelia ( no output )
rir m: my %h; %h<bar> = [=>] <a b c>; %h.say; 20:24
camelia {bar => a => b => c}
rir coke ^
guifa_ tonyo ugexe is there a size limit for fez? 20:45
i uploaded a new one and fez gave me a success message, but it dosn't pul up on raku.land (but I also didn't get an error message) 20:46
[Coke] Nemokosch++ rir++ 20:50
Nemokosch rir wow, that's also an interesting solution 21:08
sortiz m: my %foo; reduce -> $h, $k { $h{$k} = {}; $h{$h.keys[0]} }, %foo, |<bar this that other>; say %foo; # [Coke] 22:11
camelia {bar => {this => {that => {other => {}}}}}
gfldex I had a look at Erlang today. Wouldn't be surprised when they sue us. :-> 23:01
Nemokosch I don't think Erlang was very similar but it seemed like a decent language 23:04