3 ms·
Any reason why you don't give addition and concatenation distinct operators? Perl does this and it's a lot cleaner IMO. Whenever you see a "+" you can consider
by hoytech 7y ago
Any reason why you don't give addition and concatenation distinct operators?
Perl does this and it's a lot cleaner IMO. Whenever you see a "+" you can consider it an explicit numeric conversion of both arguments: https://codespeaks.blogspot.com/2007/09/ruby-and-python-overload-operator-for.html https://codespeaks.blogspot.com/2007/09/ruby-and-python-over...
In fact, there is no dedicated numeric conversion operator in perl. The canonical "operator" for this is called the "0+" operator.
Python-style dynamic-typing and strictness is sort of the worst-of-both-worlds approach. Many times I've lost rarely-seen log messages to "cannot concatenate 'str' and 'int' objects" errors.