effect
effect copied to clipboard
Equal in 4.0 (Proposal)
I propose to change how equality works in 4.0 to be more structural by default, the idea would be:
- consider plain objects, arrays, sets and maps structurally
- consider non plain objects (prototype !== Object.prototype) by reference
- provide a byReference function backed by a weakmap to consider an instance of an object as by reference
We previously backed off from structural by default due to errors with circular structures but this was mainly due to considering ALL objects structurally (i.e. also custom classes). We should also be able to deal with circular structures by detecting loops.
Does this mean that equals(new Thing(),new Thing()) will be false? 🤔
Does this mean that
equals(new Thing(),new Thing())will be false? 🤔
depends how Thing is defined, not if it is defined via Data