Well, Perl has a tendency to take the attitude that it should warn when you are most likely doing something stupid, and to not to warn when you probably aren't. Thus you see things like "0 but true" NOT warning
C:\Temp>perl -we"print 0+'0 but true'"
0
C:\Temp>perl -we"print 0+'0 and true'"
Argument "0 and true" isn't numeric in addition (+) at -e line 1.
0
Since I can't think of any remotely sane reason why one would do a string or numeric comparison other than '==' or 'eq' on a ref (ok, I lie, I can think of one, but its pretty sucky, that being that you can sort references into an arbitrary but repeatedable order using reference comparison), therefore it doesnt seem to me to be unreasonable to warn in these situations. Whereas 0+ implies the decision was intentional and not accidental, and overloading implies that the operation is specifically allowed, and '==' is the normal way for doing equivelency tests on refs, so you dont want to warn in those situations.
What would this really mean for the programmer? Well it means that when they want to violate the encapsulation that references provide and use an arbitrary value (the memory location of the ref) for something it probably shouldn't be used for they need to signal to the interpreter that they would like to blow their foot off, by using the 0+ disambiguation. IMO this would probably catch a few bugs, and maybe break some code that uses references as hashkeys without using the 0+ disambiguation, something that could itself be special cased, or probably better just be worked around with a 0+.
Anyway, I doubt any of this will ever happen, but I thought I would express what I consider to be the way it might make sense.
---
$world=~s/war/peace/g
|