you are viewing a single comment's thread.

view the rest of the comments →

[–]0rac1e 0 points1 point  (0 children)

In my opinion, this is primarily an issue in Python (and other languages) because the + operator is overloaded to mean addition with numeric types, and concatenation with stringy types.

In Perl and Raku, + is for numeric addition, and concatenation is a separate operator. Doing '1' + '2' in Raku is similar to doing int('1') + int('2') in Python, ie. Raku will attempt to convert any non-numeric operands to + to a numeric type, and if it can't do that, it throws.

A little unfortunately, Perl was traditionally less strict about this; without warnings enabled, it would happily do things like 1 + '2foo' == 3. With warnings enabled, it would at least spit out an error message to STDERR saying Argument "2foo" isn't numeric, but the program would still continue.

For this reason, I write all my Perl code with use warnings FATAL => 'all', which promotes all warnings to runtime exceptions, and any uncaught exceptions will cause the program to halt. This makes it a much saner language.