On Sat Feb 20 13:31:33 2010, masak wrote: > <spinclad> rakudo: say False ~~ True > <p6eval> rakudo ec47f3: OUTPUT«1» > <masak> o.O > <spinclad> (which is Worng) > <colomon> alpha: say False ~~ True > <p6eval> alpha 30e0ed: OUTPUT«1» > <lue> pugs: say False ~~ True > <p6eval> pugs: OUTPUT«» > * masak submits rakudobug > <masak> can't believe no-one caught this before.
No one caught this so far, because it's according to the spec. Read http://perlcabal.org/syn/S03.html#Smart_matching :-) Afaict this was the case so that given $thing { ... when True { # always matches } } But we might wish to change that, and use when * As the always matching alternative. At least I'd find it more intuitive if smart-matching against Bool would coerce the the LHS to Bool and then do a comparison, much like smart-matching against strings and numbers work. The downside is that then given $thing { when some_function($_) { ... } } won't work as intuitively expected if $thing is false and some_function returns True. But IMHO this is not what smartmatching and given/when is meant for (at least not primarily), so we could sacrifice this possible usage. But I won't do so without permission from Larry. Cheers, Moritz