|
|
|
|
|
by raiph
3817 days ago
|
|
> implicit conversion of numeric strings to numbers in certain contexts. In Perl 6 at least, and to a large degree Perl 5 too, context only "causes" bugs if coders make assumptions that are invalid in Perl. For example: say $foo + $bar
adds two numbers. So the context for $foo and $bar is numeric. So Perl coerces them to be numbers. If you didn't mean to add two numbers, don't use a numeric operation such as `+`.If you want Perl 6 to make sure $foo and $bar are numbers already, then add a type to their declaration: my Int ($foo, $bar);
|
|