News for hackers. Stuff that matters.
Re:Why Perl 6 is Different (2010) by raiph on Tuesday January 12, 2016 @01:50PM (#10889458)
> 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);

There are no comments on this comment yet.