If the thought is that distinguishing +0 and -0 is never useful, then the goal should be to stop distinguishing between them wherever possible.
Currently there are three "strict-ish" equality tests: Strict Equality Comparison (`===`), SameValueZero, and SameValue (`Object.is`). We'll leave Abstract Equality Comparison (`==`) out of this. - Strict Equality Comparison is used in `case` matching, `Array.prototype.indexOf`, `Array.prototype.lastIndexOf`, and `===`. - SameValueZero is used for `Map`s and `Set`s, plus something about `ArrayBuffer` lengths. - SameValue is used in many places throughout the spec, especially relating to property values; it is also used for `WeakMap`s and `WeakSet`s. Note that most of the uses of SameValue are cases where the input is already guaranteed to be either an object (e.g. prototypes, property descriptor `set` functions) or a string (property keys). So many of them could be replaced with SameValueZero, or even Strict Equality Comparison, without consequence. But there are a few cases, e.g. property redefinition, that do distinguish. For example, if you have a non-writable/non-configurable property whose value is -0, then trying to set/redefine that property will fail, since SameValue is used in that test. If the belief is truly that SameValueZero is more useful than SameValue, perhaps we should consider relaxing that restriction, and allowing people to flip the sign of non-writable zero-valued properties? Indeed, perhaps it would be worth trying to move some of the strict equality comparisons over to SameValueZero, if that doesn't break too many things. I know moving to SameValue has been discussed and rejected in the past, but that was before SameValueZero was baked into the spec. (I personally dislike the existence of SameValueZero, and would rather stick with SameValue. But I have no reasonable arguments from practicality, only theoretical purity, and so I don't anticipate convincing anyone.) _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

