This channel is intended for people just starting with the Raku Programming Language ( Logs are available at
Set by lizmat on 8 June 2022.
02:26 tea3po joined 02:29 teatwo left 02:30 tea3po left 02:31 tea3po joined 13:38 uzl[m] left, uzl[m] joined
Tirifto Hello again! Is there any way I can disable slurping of extra named arguments (into *%_) in a given method? 13:39
nemokosch m: class Demo { method yuck($a, $b, *%_ ()) { say "$a $b NONE"; } } Demo.yuck: 1, 2; Demo.yuck: 1, 2, :2kilos; 13:43
Raku eval 1 2 NONE Exit code: 1 Unexpected named argument 'kilos' passed in sub-signature of parameter %_ in method yuck at main.raku line 2 in block <unit> at main.raku line 7
nemokosch pretty sure that the whitespace is necessary there btw 13:44
Tirifto I made two variants of a multi method in a class, with two different signatures: :(:$from, :$to) and :(:$to). The superclass has the same method using the former signature. The former method was supposed to do some stuff and then call the superclass’s method with ‘nextsame’. The latter was supposed to fill in the :$from argument and call ‘nextsame’ as well. But to my surprise, when the former called ‘nextsame’ 13:46
, the latter still qualified, because the ‘:$from’ argument (which the latter’s signature is missing) got slurped into *%_, so the signatures matched. Just to give some context. x)
nemokosch don't forget that named arguments are optional by default 13:48
this is true regardless of the very regrettable named-slurping of methods 13:49
Tirifto @nemokosch: Interesting. What does the () mean there? Is that a sub-signature saying that the argument should be empty, or is it something else? :o 13:51
nemokosch well, I'm very suspicious that it's a destructuring 13:53
Tirifto Also thanks, I had actually forgotten to make the arguments mandatory! Doing so didn’t fix the current problem at all, but it might very well save me trouble down the road. x) 13:54
Ohh, destructuring. 13:55
Okay, so just setting a default value on ‘:$from’ in the signature was enough in this case! Somehow I hadn’t thought of that. 14:02
(And doing away with the other method altogether.) 14:03
14:20 jgaz left 14:25 teatwo joined 14:28 tea3po left 15:32 jgaz joined 15:33 jgaz left 15:34 jgaz joined 16:49 CIAvash left, CIAvash joined 21:35 habere-et-disper joined
habere-et-disper I have a `token` that has a negative character class : 21:38
`token not-bracket { <-[()\[\]{}]> + }`
I'd like to write it more clearly (without the escaping). How do I do that ? Can I use '()[]{}'.comb.none ?