Re:My Opinion on “5” == 5
by int_19h on Thursday July 29, 2021 @04:31PM
(#28001113)
"Shouldn't compare" is not the same as "should compare but return false".
[ Parent
| on HN ]
If you could do relative comparisons like "5" < 5 and get a boolean answer, that would be surprising. I don't see anything controversial, however, about unequivocally reporting that objects of different types are unequal. In Lua anything can be tested for (in)equality but asking whether a string is greater than or less than a number is an error, as is performing an ordered comparison involving any other type(s).