If we rely on the overloaded === operator we run into trouble with ad-hoc lazy evaluation powered by Proxy based thunks. The expression thunk === null, for instance, doesn't force the evaluation of thunk to weak head normal form because === doesn't provide a trap thunk's Proxy could hook into.
Eq should probably include eq/neq in two flavors, one with reference equality for object types as usual and another that pursues structural/value equality. The underlying issue will also be addressed by immutable records/tuples but this doesn't render the type class approach redundant.
If we rely on the overloaded
===
operator we run into trouble with ad-hoc lazy evaluation powered byProxy
based thunks. The expressionthunk === null
, for instance, doesn't force the evaluation of thunk to weak head normal form because===
doesn't provide a trap thunk'sProxy
could hook into.Eq
should probably includeeq
/neq
in two flavors, one with reference equality for object types as usual and another that pursues structural/value equality. The underlying issue will also be addressed by immutable records/tuples but this doesn't render the type class approach redundant.