in reply to Perl6::Rules Rules
I'm guessing "oporm" is short for "optional plus or minus", but it took me a while to guess that. I'd suggest replacing it with:
and using <sign>? instead of <oporm> in the other rules to improve readability.rule sign { <[+-]> }
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.
I'd normally expect a function 'is_thing' to be asking a question that returns a boolean though, and to use it like:
and would usually name functions such as yours more like 'as_thing':if (is_fixed($string)) { ... it's a number ... }
my $num = as_scino($string);
Hugo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl6::Rules Rules
by duff (Parson) on Aug 04, 2004 at 14:34 UTC | |
by Aristotle (Chancellor) on Aug 04, 2004 at 18:33 UTC |