See https://github.com/paulmillr/es6-shim/pull/200
1) The spec for Map.prototype.set (23.1.3.9) still mentions [[MapComparator]]. This should be removed, IIUC.
2) What is this code expected to do?
var m = new Map();
m.set(-0, 'a');
m.forEach(function(v,k) { console.log(1/k); });
m.set(1, 'b')
m.set(0, 'c');
m.forEach(function(v,k) { console.log(1/k); });
Current Firefox prints "Infinity", "Infinity, "1". That is, the "-0" key is converted to +0 before being added to the Map. This seems to be wrong according to the spec (but I'd like to confirm that).
I expect this code to print "-Infinity", "-Infinity", "1". That is, the key stored in the set is -0, and since SameValueZero(0, -0) is true, the key is not updated by the final set operation, nor is the insertion order changed.
A similar issue applies to Set -- according to the spec I expect this to print "-Infinity":
var s = new Set();
s.add(-0);
s.add(0);
s.forEach(function(v) { console.log(1/v); });
If the current spec is correct, then Map and Set are inconsistent with how objects store fields. This is the equivalent code using an object as a map:
var o = Object.create(null);
o[-0] = 'a'
Object.keys(o).forEach(function(k) { console.log(1/k); });
o[1] = 'b'
o[0] = 'c'
Object.keys(o).forEach(function(k) { console.log(1/k); });
This code emits "Infinity", "Infinity", "1" like Firefox's current Map implementation (but *not* like the current Map specification).
Item #1 in comment #1 seems to be addressed by bug 2496. So let's focus this bug on whether Map/Set should coerce -0 to +0 when used as a key, in the same way -0 is coerced (via ToString conversion to "0") when it is used as an object property key.
fixed in rev23 editor's draft
yes, for Map and Set to work consistently, -0 has to be normalized to +0 in Map.prototype.set and Set.prototype.add
fixed in rev23 draft