3 ms·
Just define your own equality operator? Eg in Haskell, whether things can be compared for equality depends on their representation. (Eg church encoded datatyp
by eru 10y ago
Just define your own equality operator?
Eg in Haskell, whether things can be compared for equality depends on their representation. (Eg church encoded datatypes do not lent themselves to the built-in derivation of the == operator.)
- catnaroek 10y ago> Just define your own equality operator? Have fun doing that in JavaScript. Have fun making objects/hashtables use your custom equality operator when comparing field names. Have fun making sure that every single part of your program respects the notion of equality defined by your custom equality operator. > Eg in Haskell, whether things can be compared for equality depends on their representation. In any higher-order langauge, that's a feature, not a bug.
- wereHamster 10y agoIf you can't use the builtin `==` operator, you can throw away much of the builtin functionality. The runtime uses `==` in far too many places without ability to provide your own comparator. You want to use your own types as keys in a `Map` or `WeakMap`? Yeah, not going to work.
- deleted 10y ago[deleted]