Any math operation (excluding ==) on a reference that doesnt have the references nummified by 0+$ref and doesnt have the operators in question overloaded in the package the ref is blessed into should warn.I disagree. That's contrary to Perl's automatic casting for programmer convenience. What's next, concatenation of numbers throws a warning, unless the number is surrounded with quotes? Use of an array as a number throws a warning, unless it's explicitely preceeded with '0+'? Using a string as first argument of split throws a warning, because it isn't surrounded by slashes?
If you want a language that will throw warnings if casting happens implicitely, use C.
I don't think that the attitude of "oh, I made a programming boo-boo, let's add a warning that prevents me from making the boo-boo again" is very productive. It will only annoy people who legitimate use this feature (that has been around for over a decade!) - and it will make people not use use warnings;. Or to not use perl.
Warnings are good. But a warning that triggers at the wrong moment is bad. Very bad. Warnings should never get in the way.
In reply to Re^2: The trap of reference numification
by Perl Mouse
in thread The trap of reference numification
by samtregar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |