SameValueZero comparator and compatibility

Allen Wirfs-Brock allen at
Tue Jan 21 10:14:05 PST 2014

On Jan 21, 2014, at 9:58 AM, Brandon Benvie wrote:

> The implementations of Maps and Sets in the wild that I am aware of (IE11, SpiderMonkey, and V8 behind a flag) all currently use SameValue as comparator while the spec calls for SameValueZero. It seems like either the implementations need to update (quickly) to match the spec. before too much code depends on this, or the spec should be changed to match the implementation reality.
> This discrepancy has the potential to make for some hard to trace bugs, due to the otherwise near-invisibility of the -0/0 difference. Regardless of the merits of each comparator, I think at this point it's more important that everyone (implementers + spec.) is following the same marching orders.

This was pretty throughly discussed during TC39.  SameValue0 is a very intentional choice.  The marching orders are the spec. 


More information about the es-discuss mailing list