3 ms·
Without explicit comments/documentation it is hard to imagine a good example. Its a longstanding issue. Even Lisp has 'equals' and 'equals?' which is an abomina
by JoeAltmaier 11y ago
Without explicit comments/documentation it is hard to imagine a good example. Its a longstanding issue. Even Lisp has 'equals' and 'equals?' which is an abomination. One looks for identity of object; the other for identity of value (if I understand it right). These kind of things are bug factories.
- icebraining 11y agoI think Python make the difference clear, with == vs "is".
- msbarnett 11y agoRuby provides object_id for the same purpose. Comparing those for equality provides the "is_" semantics.
- deckard1 11y agoKent Pitman has always been a good read, for the problems of equality in dynamic languages. The typical Ruby or JS programmer stumbles through the day just "getting by", where it comes to comparing objects. http://www.nhplace.com/kent/PS/EQUAL.html http://www.nhplace.com/kent/PS/EQUAL.html
- lispm 11y agoLisp does not have 'equals' and 'equals?'. Lisp has 'eq', which is for object identity. Lisp has 'equal' which checks for structural equality.
- JoeAltmaier 11y agoand 'equals?'