archives

« Bugzilla Issues Index

#1558 — 15.14.4.4 Map.prototype.forEach step 8.a


8. Repeat for each Record {[[key]], [[value]]} e that is an element of entries, in original key insertion order
a. If e.[[key]] is not empty, then


Can you clarify what is meant by "is not empty"? Current prototype implementations allow any of "" (empty string), false, null or undefined as a valid map key.


That should probably be *empty*.

*empty* is a specification value (it's not an ECMAScript value) that is generally used to indicated that an internal field has not yet been assigned an ECMASript value. See 8.2.3. I probably should make this definition more explicit.

If you look at the Map delete method you will see that delete is specified as setting the key of a key/value record to *empty*. This is totally a specification device for talking about the effect of delete.


Ok, that makes sense. The issue was that the implementor had translated that to something like...

for (let [k, v] of map) {
if (k) {
...
}
}

Which didn't seem right considering the accepted keys cases


added to clarify note to Map/Set/WeakMap/WeakSet delete specifications.


fixed in rev16 draft. July 15, 2013