Aaron Sherman wrote:
> In this code:
>
> given False {
> when True { say "True" }
> when False { Say "False" }
> default { say "Dairy" }
> }
>
> I don't think it's unreasonable to expect the output to be "False".
In this code:
sub test() { True };
given 0 {
when test() { say "OH NOEZ" }
}
I don't think it's unreasonable to expect the output to be "OH NOEZ".
> However, it actually outputs "True". Why? Well, because it's in the
> spec that way. So... why is it in the spec that way?
Because you can't have a ponie, and eat it. Or so.
You can't please everyone, so we try to please at least some of the
people, and in the future you can expect a warning from a bare True or
False in a 'when', or on the RHS of a smart-match.
STD.pm already implements that warning, Rakudo doesn't. (But I'd
appreciate it if some brave soul could port the warning over to Rakudo,
shouldn't be too hard)
Cheers,
Moritz