in reply to Re: Perl6::Rules Rules
in thread Perl6::Rules Rules
The $num = $num + 0; ensures the returned result will be treated as a number if used in an ambiguous context, such as with a bitwise operator. So yes, if the is_* functions are documented to return a number it's helpful to do this.
Would that he were using a real Perl6, he could just use unary + on the return to force numeric context:
return +$num;
This would remove the extra, potentially confusing addition which IMHO is a good thing. /me waits for Perl6 with bated breath.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Perl6::Rules Rules
by Aristotle (Chancellor) on Aug 04, 2004 at 18:33 UTC |