Re: say Cool-concat-junction question
Dumped this to https://github.com/rakudo/rakudo/issues/2568 -y
Re: say Cool-concat-junction question
Thanks for this explanation El dom., 23 dic. 2018 a las 7:39, Brad Gilbert () escribió: > turns out there is a candidate for > > Str:D, Junction:D > > but not for > > Any:D, Junction:D ... An improvement would be to change the "Str:D, Junction:D" candidate on concatenation to the coercion "Str(Cool:D), Junction:D" - or even "Str(Any:D), Junction:D" to accept anything that stringifies...? Last time I looked at coercion I didn't fully understand it, let me know if that fix is broken. -y
Re: say Cool-concat-junction question
El dom., 23 dic. 2018 a las 7:39, Brad Gilbert () escribió: > I turns out there is a candidate for > > Str:D, Junction:D > > but not for > > Any:D, Junction:D > > so it is going through one of the other :<~> candidates, > specifically it looks like it could be > > *@args > > Which doesn't apparently work with Junctions. So yes it is a bug. > Um, not sure about that. One might expect a distributive property of the kind a ~ f(b,c) would do something like f(a~b, a~c), but this does not need to apply in this case, maybe because in this particular Any case a~b and the rest would work, but not in general (because there might not be a sensible stringification of a). This works, for instance: say '3' ~ (3|'4') If you think it's a bug, or simply inconsistent behavior, you could file an issue, anyway. But I'm not so sure in this case. Cheers JJ
Re: say Cool-concat-junction question
I turns out there is a candidate for Str:D, Junction:D but not for Any:D, Junction:D so it is going through one of the other :<~> candidates, specifically it looks like it could be *@args Which doesn't apparently work with Junctions. So yes it is a bug. On Sat, Dec 22, 2018 at 9:05 PM yary wrote: > > What's going on here- is this error a mistake on my part, or a bug? > > $ perl6 -e "say 3 ~ ( 'a' | 'b' )" > > Type check failed for return value; expected Str:D but got Junction > (any("3a", "3b")) > > in block at -e line 1 > > > $ perl6 -e "say 'x' ~ ( 'a' | 'b' )" > > any(xa, xb) > > > $ perl6 -v > > This is Rakudo Star version 2018.10 built on MoarVM version 2018.10 > > implementing Perl 6.c. > > > > -y