SameValueZero comparator and compatibility

Brandon Benvie bbenvie at mozilla.com
Tue Jan 21 09:58:20 PST 2014


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.


More information about the es-discuss mailing list