Is the informative definition of [[Enumerate]] buggy?

Allen Wirfs-Brock allen at
Wed Aug 26 19:33:54 UTC 2015

On Aug 26, 2015, at 11:03 AM, Raul-Sebastian Mihăilă wrote:

> In 9.1.11. it's specified that the iterator returned by the [[Enumerate]] method iterates over String-valued keys. But the informative definition at the end of 9.1.11. is based on whatever is returned by calling Reflect.enumerate on the prototype of the current object, assuming that there is such a prototype. 
> If the prototype is a proxy and it's enumerate trap returns an iterator that yields other kind of values than strings, then our original object's [[Enumerate]] method will give us non-string keys as well. And they can be any kind of values, not only symbols.

And the prototype [[Enumerate]] could return the same value multiple times, which would also be a violation of the normative requirments expressed in 9.1.11

The final if statement in the informative algorithm should probably be replaced by:

if (!visited.has(protoName) && typeof protoName === "string") {
   yield protoName;

I opened a bug for this: 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list