Just to let you know we fixed this, in Perl 6 this is written:
$x = ?$y;
And the standard operators like == are expected to return 0 or 1 when a boolean result is expected. (Boolean context will still accept any true value, as in Perl 5, and the short-circuit operators still return one of the input values as the "true" value.),
Yes, you can still overload these to return something other than 0 or 1, but it would be construed as antisocial.
| [reply] [Watch: Dir/Any] [d/l] [select] |
| [reply] [Watch: Dir/Any] |
Except Perl 5 makes no such guarantee. A lot of the built-ins return "" or 1 instead, for instance.
| [reply] [Watch: Dir/Any] [d/l] |
I said shorter, I didn't say accurate.
If it doesn't need to be accurate, $x=1 is pretty short.
| [reply] [Watch: Dir/Any] |