|
|
|
|
|
by tangledweb
4677 days ago
|
|
I think you are stretching the hammer analogy well beyond its useful limit. I've no idea what php function you think has a redundant left and right version, but to humor you, sure there are lots of nail pullers that have two similar sides or ends to attack different sizes.
eg http://s.shld.net/is/image/Sears/00938076000
There are also lots of physical tools that completely reasonably do have exactly duplicated sides or ends because they wear out, but I don't see how you want that to apply to software. Talking about == is not trivial or apologetic. That's the way I expect comparison to work in a loosely typed language. I expect 0, 0.0, '0', '0.0', -0, 00, 0x00, null and false to be logically equivalent most of the time. If it also means that if I don't validate input from an http request 0=='0 foodle fish' also evaluates as true, then that's a cost I'm willing to bear. |
|
I don't see how this is anything but bugprone, and all to save you from actually saying what you meant and slapping a couple int()s on your input.
Compare JavaScript, a language with much the same == problems, where the community generally advises against ever using == at all. CoffeeScript (different syntax that compiles directly to JavaScript) even translates == into ===, leaving the original buggy operator unavailable.