🦋 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.
00:01 hudo_ joined 00:03 LainExperiments left, hudo left 00:04 wbooze joined 00:05 Sgeo joined 00:10 wbooze left 00:13 LainExperiments joined 00:28 kjp left, kjp_ joined 00:30 kjp_ left 00:31 kjp joined 01:40 LainExperiments9 joined 01:41 LainExperiments left 01:48 Voldenet left 01:56 Voldenet joined 02:35 Aedil joined 02:46 hulk joined 02:47 kylese left 03:08 yewscion joined 03:12 yewscion left 03:15 hulk left, kylese joined 03:28 LainExperiments9 left 04:44 yewscion joined 04:49 yewscion left 05:09 discord-raku-bot left 05:10 discord-raku-bot joined 05:33 yewscion joined 05:51 yewscion left 06:16 tjr left, tjr joined 06:19 Aedil left 06:29 yewscion__ left, Geth left, jetchisel left, rba left, elcaro left, thowe left, lucs left, charsbar left, Voldenet left, bdju left, dmvrtx left, BooK left, Guest7021 left, snonux left, dpk left, SmokeMachine left, perryprog left, Tirifto_ left, maylay left, thaewrapt left, grondilu left, leah2 left, skaji__ left, tobs left, greenfork left, jmcgnh left, ab5tract left, avar left, mst left, bd3i left, tjr left, kjp left, sjn left, bloatable6 left, greppable6 left, kst left, simcop2387 left, sorenson left, bisectable6 left, perlbot left, sourceable6 left, benchable6 left, shareable6 left, quotable6 left, dano left, constxd left, broquaint left, tadzik left, gugod left, slu left, tejr left, sftp left, Sevalecan left, mtj left, camelia left, sivoais left, zostay left, leedo left, Altreus left, merp left, thatonelutenist left, tellable6 left, unicodable6 left, releasable6 left, linkable6 left, committable6 left, eof left, BinGOs left, timo left, tinita left, kylese left, Sgeo left, coleman left, synthmeat left, jaguart left, xelxebar left, inspork left, destroycomputers left, ingy left, JRaspass left, tjr joined, kylese joined, Voldenet joined, kjp joined, Sgeo joined, tejr joined, sjn joined, coleman joined, Tirifto_ joined, charsbar joined, lucs joined, thowe joined, elcaro joined, rba joined, jetchisel joined, Geth joined, yewscion__ joined, tobs joined, skaji__ joined, leah2 joined, grondilu joined, thaewrapt joined, maylay joined, bd3i joined, mst joined, avar joined, ab5tract joined, jmcgnh joined, greenfork joined, perryprog joined, SmokeMachine joined, dpk joined, snonux joined, Guest7021 joined, BooK joined, dmvrtx joined, bdju joined, tadzik joined, broquaint joined, constxd joined, dano joined, quotable6 joined, shareable6 joined, benchable6 joined, sourceable6 joined, perlbot joined, bisectable6 joined, sorenson joined, simcop2387 joined, kst joined, bloatable6 joined, greppable6 joined, merp joined, sftp joined, Sevalecan joined, synthmeat joined, mtj joined, jaguart joined, thatonelutenist joined, camelia joined, sivoais joined, zostay joined, leedo joined, tellable6 joined, unicodable6 joined, releasable6 joined, linkable6 joined, committable6 joined, Altreus joined, eof joined, BinGOs joined, xelxebar joined, slu joined, gugod joined, timo joined, inspork joined, tinita joined, destroycomputers joined, JRaspass joined, ingy joined 06:30 MyNetAz left, hudo_ left, hudo__ joined, apac left, ACfromTX left, DarthGandalf left, Ekho left, gfldex left, nicole left, avuserow left, samebchase left, corwin left, jast left, jjatria left, ugexe left 06:31 constxd left, tjr left, greenfork left, Aedil joined 06:32 tjr joined 06:33 constxd joined, apac joined, ACfromTX joined, DarthGandalf joined, Ekho joined, gfldex joined, nicole joined, avuserow joined, samebchase joined, corwin joined, jast joined, jjatria joined, ugexe joined, Ekho left 06:34 greenfork joined, tjr left, kjp left, sjn left, bloatable6 left, greppable6 left, kst left, simcop2387 left, sorenson left, bisectable6 left, perlbot left, sourceable6 left, benchable6 left, shareable6 left, quotable6 left, dano left, broquaint left, tadzik left, yewscion__ left, Geth left, jetchisel left, rba left, elcaro left, thowe left, lucs left, charsbar left 06:35 yewscion__ joined, Geth joined, jetchisel joined, rba joined, elcaro joined, thowe joined, lucs joined, charsbar joined 06:36 tjr joined, kjp joined, sjn joined, greppable6 joined, bloatable6 joined, kst joined, simcop2387 joined, sorenson joined, bisectable6 joined, perlbot joined, sourceable6 joined, benchable6 joined, shareable6 joined, quotable6 joined, dano joined, broquaint joined, tadzik joined, Tirifto_ left, maylay left, thaewrapt left, grondilu left, leah2 left, skaji__ left, tobs left 06:37 Tirifto_ joined, maylay joined, thaewrapt joined, grondilu joined, leah2 joined, skaji__ joined, tobs joined 06:38 jmcgnh left, ab5tract left, avar left, mst left, bd3i left, hudo__ left, Voldenet left, bdju left, dmvrtx left, BooK left, Guest7021 left, snonux left, dpk left, SmokeMachine left, perryprog left, hudo__ joined, Voldenet joined, bdju joined, dmvrtx joined, BooK joined, Guest7021 joined, snonux joined, dpk joined, SmokeMachine joined, perryprog joined 06:39 dano2 joined 06:40 sorenson left, tjr left, dano left, dano2 is now known as dano, perlbot left, sorenson joined, jmcgnh joined, ab5tract joined, avar joined, mst joined, bd3i joined, perlbot joined 06:41 tjr joined 06:46 Ekho- joined 07:03 MyNetAz joined 08:54 jpn joined 08:58 jpn left 08:59 Sgeo left 09:00 jpn joined 09:11 dakkar joined 09:17 apac left 09:19 jpn left 09:23 jpn joined 09:28 comborico1611 joined 09:30 dmvrtx_ left 09:49 _________ left 09:56 _________ joined 10:05 jpn left 10:13 LainExperiments joined 10:22 yewscion joined 10:23 LainExperiments4 joined 10:24 LainExperiments left 10:27 yewscion left 10:44 sena_kun joined 10:45 rba left 10:49 LainExperiments4 left, MyNetAz left 10:50 LainExperiments joined, rba joined 10:54 yewscion joined 10:58 yewscion left 11:04 MyNetAz joined 11:42 yewscion joined 11:52 yewscion left 11:56 Tirifto_ left 12:02 Tirifto joined 12:10 LainExperiments left 12:18 Tirifto_ joined, Tirifto left, euandreh left, euandreh joined 12:23 LainExperiments joined 12:40 comborico1611 left 12:49 yewscion joined 12:53 hudo__ left, hudo__ joined 12:54 yewscion left, sjn left, sjn joined 13:03 jpn joined 13:04 yewscion joined 13:07 jpn left 13:09 yewscion left 13:27 LainExperiments left 13:28 LainExperiments6 joined
lizmat clickbaits rakudoweekly.blog/2025/03/03/2025-...ting-down/ 13:28
13:50 MyNetAz left 14:05 MyNetAz joined 14:18 yewscion joined 14:24 vrurg_ joined, vrurg left 14:46 LainExperiments6 left 14:58 LainExperiments joined 15:03 yewscion_ joined 15:04 yewscion left 15:21 LainExperiments left 15:48 LainExperiments joined 15:59 LainExperiments left 16:25 yewscion joined 16:26 jgaz left, jgaz joined 16:29 yewscion_ left 16:40 yewscion left 16:41 LainExperiments joined 16:46 yewscion joined 17:35 dakkar left 17:36 LainExperiments left 17:54 Guest48 joined
Guest48 bisectable: say Any === Mu 17:55
bisectable6 Guest48, Will bisect the whole range automagically because no endpoints were provided, hang tight
Guest48, Output on all releases: gist.github.com/aa29d99776a5cb7da5...6d0095a851
Guest48, More than 3 changes to bisect, please try a narrower range like old=2022.07 new=HEAD
Guest48 makes sense 17:57
> If no type is provided by the user Raku assumes the type to be Any. This includes containers, base-classes, parameters and return types. 18:00
This applies, then
> For containers the default type is Any but the default type constraint is Mu. 18:02
What does this mean, though
lizmat m: my $a; dd $a; $a = Mu; dd $a 18:05
camelia $a = Any
$a = Mu
lizmat m: my Any $a; dd $a; $a = Mu; dd $a
camelia Any $a = Any
Type check failed in assignment to $a; expected Any but got Mu (Mu)
in block <unit> at <tmp> line 1
Guest48 my @a; dd @a; 18:10
evalable6 []
Guest48 my \a = Mu; dd a;
evalable6 Mu
Guest48 couldn't the (\a, \b --> Bool) signature work based on the same principle, then? 18:12
lizmat not sure what you mean ? 18:13
Guest48 ruminating github.com/rakudo/rakudo/issues/5796 18:14
lizmat tries adapting the \a, \b candidate to Mu \a, Mu \b 18:17
breaks 6 tests in roast :-( 18:22
making it with that signature, breaks auto-threading 18:23
Guest48 auto-threading over ===? 18:25
lizmat m: say ?Int === Str|Num|Int
camelia any(False, False, False)
lizmat m: say ?(Int === Str|Num|Int) 18:26
camelia True
Guest48 Huh, this doesn't seem like a good idea at all.. 18:27
lizmat autothreading over === ?
Guest48 yes
lizmat well, how would === be different from other operators ? 18:28
m: say "a string" if "foo" ~~ Int | Num | Str
camelia a string
Guest48 m: say Int =:= Str|Num|Int
camelia False
Guest48 it is different
=== is a pretty darn low-level operation 18:29
lizmat =:= is more low level
Guest48 Still, these two are more similar than ~~ to either.
lizmat in any case, there are roast tests for it
Guest48 Then there is an answer to that issue. 18:31
lizmat tries something else 18:35
github.com/rakudo/rakudo/commit/3f6ac5a2d3 18:48
Guest48 m: say so 1&2 === 1&2
camelia False
Guest48 To me, this looks concerning with ===
lizmat m: say so 1 | 2 === 1 | 2 18:49
camelia True
lizmat m: say 1 & 2 === 1 & 2
camelia all(all(True, False), all(False, True))
Guest48 1&2 =:= 1&2 is False because the references don't match. Fair enough. But === distributes and anything that is higher-level than that will probably also distribute. 18:53
18:54 jpn joined
Guest48 Despite the fact that a Junction like this seems to have a stable hash: 18:54
m: say (1&2).WHICH eq (1&2).WHICH
camelia True
lizmat yeah, but that feels like DIHWIDT 18:56
18:56 LainExperiments3 joined
lizmat afk for a few hours& 18:57
Guest48 I don't think equal-checking for a junction means intrinsically less sense than using === to query its elements
makes*
Especially since you can do this:
m: my %all-goes-here{Mu}; %all-goes-here{1|2} = 3; dd %all-goes-here 18:58
camelia Any = (my Any %{Mu} = any(1, 2) => 3)
Guest48 If a junction can end up as the key of a hash (probably also not a good idea but bugs exist), at the very least one should have a way to detect the value 18:59
18:59 LainExperiments joined
Guest48 Anyway, the good news is the same as the bad news: using .WHICH will get you different behavior and then you might prefer that. It probably also works instead of the code in the issue. :) 19:01
19:02 Guest48 left 19:03 LainExperiments3 left 19:19 jpn left 19:28 LainExperiments5 joined 19:29 LainExperiments left 19:41 jjido joined 20:00 LainExperiments joined 20:02 LainExperiments5 left 20:12 Aedil left 20:15 LainExperiments left 20:39 LainExperiments joined 20:48 LainExperiments left 21:07 wbooze joined 21:14 charsbar left 21:15 sjn left, jetchisel left 21:16 sjn joined, elcaro left, dg left 21:17 jetchisel joined 21:19 charsbar joined 21:20 Xliff left, acidsys left, patrickb left, atweedie left, peder left, evalable6 left, PotatoGim left, tailgate left, Xliff joined, acidsys joined, patrickb joined, atweedie joined, peder joined, evalable6 joined, PotatoGim joined, tailgate joined 21:23 dg joined, yewscion left 21:27 yewscion joined, elcaro joined
Xliff Hello. 21:30
If I have a grammar with a proto, is there any way I can get the :sym value of the proto that matched? 21:31
librasteve hi - I think I saw an example of that ... rootling now 21:32
Xliff m: grammar A { proto aa { * }; token aa:sym<aa> { 'AA' }; token TOP { <aa> }; }; A.parse("aa").gist.say'
camelia ===SORRY!=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> TOP { <aa> }; }; A.parse("aa").gist.say<HERE>'
expecting any of:
infix
infix stopper
statement end
statement modifier…
Xliff m: grammar A { proto aa { * }; token aa:sym<aa> { 'AA' }; token TOP { <aa> }; }; A.parse("aa").gist.say
camelia No such method 'aa' for invocant of type 'A'. Did you mean 'at'?
in regex TOP at <tmp> line 1
in block <unit> at <tmp> line 1
21:33 yewscion left
Xliff m: grammar A { rule TOP { <aa> }; proto aa { * }; token aa:sym<aa> { 'AA' }; }; A.parse("aa").gist.say 21:33
camelia No such method 'aa' for invocant of type 'A'. Did you mean 'at'?
in regex TOP at <tmp> line 1
in block <unit> at <tmp> line 1
Xliff m: grammar A { rule TOP { <aa> }; proto method aa { * }; token aa:sym<aa> { 'AA' }; }; A.parse("aa").gist.say
camelia Cannot resolve caller aa(A:D); Routine does not have any candidates. Is only the proto defined?
in regex TOP at <tmp> line 1
in block <unit> at <tmp> line 1
Xliff m: grammar A { rule TOP { <aa> }; proto token aa { * }; token aa:sym<aa> { 'AA' }; }; A.parse("aa").gist.say
camelia Nil
timo "proto" by default gives you a sub 21:34
Xliff m: grammar A { rule TOP { <aa> }; proto token aa { * }; token aa:sym<aa> { 'AA' }; }; A.parse("AA").gist.say
camelia 「AA」
aa => 「AA」
Xliff So the only thing returned is the proto, not the exact multi (or sym).
21:34 LainExperiments joined
Xliff Would love to see if there was a way to get "aa:<aa>" in that output, somehow. 21:35
timo how do you mean "returned"?
captured?
Xliff The parse output. I guess captured might be a better way. 21:36
timo thing about capture is that the caller is responsible for putting the result where it goes, not the callee
Xliff So... maybe an action class?
timo that's why you can <.aa> or <foo=.aa> etc
yeah, action classes go great with proto tokens with :sym 21:37
Xliff m: grammar A { rule TOP { <aa> }; proto token aa { * }; token aa:sym<aa> { 'AA' }; }; class AA-Actions { method aa:sym<aa> { say 'AA' }; }; A.parse("AA", action=AA-Actions.new).gist.say
camelia ===SORRY!=== Error while compiling <tmp>
Undeclared routine:
action used at line 1
Xliff m: grammar A { rule TOP { <aa> }; proto token aa { * }; token aa:sym<aa> { 'AA' }; }; class AA-Actions { method aa:sym<aa> { say 'AA' }; }; A.parse("AA", action => AA-Actions.new).gist.say
camelia 「AA」
aa => 「AA」
timo i think it's actions rather than action 21:38
Xliff m: grammar A { rule TOP { <aa> }; proto token aa { * }; token aa:sym<aa> { 'AA' }; }; class AA-Actions { method aa:sym<aa> { say 'AA' }; }; A.parse("AA", actions => AA-Actions.new).gist.say
camelia Too many positionals passed; expected 1 argument but got 2
in method aa:sym<aa> at <tmp> line 1
in regex aa:sym<aa> at <tmp> line 1
in regex aa at <tmp> line 1
in regex TOP at <tmp> line 1
in block <unit> at <tmp> line 1
librasteve Xliff: maybe this pattern would work for you docs.raku.org/language/grammar_tut...e_and_made ... specifically with the action - say $match<command>.Str; # OUTPUT: «update␤» ???
timo and action methods need to take the match object as first positional arg
Xliff m: grammar A { rule TOP { <aa> }; proto token aa { * }; token aa:sym<aa> { 'AA' }; }; class AA-Actions { method aa:sym<aa> ($/) { say 'AA' }; }; A.parse("AA", actions => AA-Actions.new).gist.say
camelia AA
「AA」
aa => 「AA」
Xliff Aha!
So the Action class is basically how I have to note differences in the proto? :P 21:39
librasteve oh - looks like you got there already!
timo well, you can do something specific in the multi token as well
it just doesn't happen on its own automatically 21:40
librasteve fwiw I have tried to not use actions and found that this is nigh on impossible due to the backtracking behaviours ... it is well worth trying out make / made and getting a feel for what they provide
timo you can use the <sym> rule to match what's in the :sym<here> of your token/rule/regex, and if you spell it <sym> rather than <.sym> it will also show up in the capture
but the "sym" you want isn't always literally what you want matched 21:41
it might be kind of interesting to be able to just put whatever you want into the match result, regardless of what the actual regex provides in terms of capturing bits. though possibly also rather confusing if you encounter it in someone else's code 21:44
21:45 sdomi joined 22:01 LainExperiments left 22:07 jgaz left 22:09 yewscion joined 22:10 yewscion_ joined 22:12 yewscion left 22:21 LainExperiments joined 22:38 wbooze_ joined 22:41 wbooze left 22:45 LainExperiments left 23:00 vrurg_ left, vrurg joined 23:08 yewscion_ left, wbooze_ left, wbooze_ joined 23:31 LainExperiments joined 23:49 jjido left