This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html Set by lizmat on 8 June 2022. |
|||
00:00
Tirifto left
00:11
Tirifto joined
07:46
teatwo left
07:47
teatwo joined
08:02
dakkar joined
09:36
teatwo left,
teatwo joined
10:19
teatwo left
10:20
teatwo joined
|
|||
librasteve | @gfldex - sorry if I implied that you don't know what is going on - for sure you are way more familiar with the raku implementation than I am | 10:59 | |
in trying to understand your points, in the light of the question, I think that (when you mention a bug in rakudo) you are considering the behaviour of a parameter that is both Positional (ie has an @ sigil) and optional (ie has ? suffix) ... if your mention of a bug is wider than that, then I would appreciate if you can explain more fully (or maybe there is an issue I can look at) | 11:04 | ||
and the "dodgy" behaviour is that, unlike an optional parameter that is a Scalar (ie has an $ sigil) which will give an (Any) in the absence of an argument, a Posiitonal will fire Array.new and then, if I follow your line of discussion correctly you are thinking that maybe this DWIM behaviour was introduced by Larry to meet the expectations of most coders who would want an Empty Array [] inside the sub | 11:16 | ||
rather than an (Array) type class in the absence of a param. This is after all the same effect of declaring my $x; (Mu $x = Any) and My @a; (Mu @a = []) at the start of the sub block and it is one role of the Signature to declare the argument vars for the block ... so maybe you are saying that the current design is OK (ie. not a bug) although it is a bit illogical ? | |||
12:13
greenfork left,
KOTP left,
greenfork joined,
KOTP joined
12:48
camelia left
12:51
camelia joined
|
|||
lizmat | And yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2024/06/17/2024-...explained/ | 13:35 | |
13:44
teatwo left,
teatwo joined
16:40
dakkar left
|
|||
gfldex | Yes, but it's a little contrived: sub foo(|c (@a?) ) { dd c, @a; } foo(); | 18:39 | |
So you have to use a Capture with a sub-signature and introspect the Capture. | 18:40 | ||
The thing that tripped me off are type-captures. What does sub f(::T $a?){}; f() even mean? How can we capture a type of a value that isn't there? Shouldn't T =:= Nil in this case? When asking for a type capture, we are telling the compiler: Bind $a to a thing and then store its type in T. If the binding never happens, how can the compiler follow that instruction? As shown above, we can tell the difference | 20:53 | ||
between an empty Array and the case where no Array was bound to by going through a sub-signature (or using a multi). Does that fulfil the design principle: „Easy things should be easy and hard things should be possible.“? | |||
m: sub bar($a? is raw) { dd $a; } bar(); | 20:58 | ||
Raku eval | Any | ||
gfldex | Also, why can I do that ^^^ ? | 20:59 |