It looks like [[OwnPropertyKeys]] is defined to return an iterator.
But the ordinary [[OwnPropertyKeys]] method produces the List of keys
to be iterated eagerly, and pretty every place that calls the method
immediately consumes the entire iterator. So there is no actual
laziness.

This is weird. I think it would be clearer for [[OwnPropertyKeys]] to
return a List of PropertyKeys.

Except for proxies, this doesn't change behavior. Here are the changes
needed to implement this:

* In 9.1.12, the ordinary object [[OwnPropertyKeys]] method, change
step 3 to just say "Return keys." instead of "Return
CreateListIterator(keys)."

* In 9.5.12, the Proxy [[OwnPropertyKeys]] method, treat the return
value as an iterable (not an iterator) and convert it to a List of
PropertyKeys using IteratorStep, IteratorValue, and ToPropertyKey.
Change the NOTE to describe the new invariant.

* In 19.1.2.1 Object.assign, 19.1.2.8.1 GetOwnPropertyKeys, 19.1.2.14
Object.keys, and 19.1.2.15.1 MixinProperties, drop the IteratorStep
boilerplate.

* In 26.1.10 Reflect.ownKeys(), convert the result of calling
[[OwnPropertyKeys]] to an Array using CreateArrayFromList.

Note that 7.3.10 SetIntegrityLevel and 7.3.11 TestIntegrityLevel
already assume that [[OwnPropertyKeys]] returns a List, as proposed.

-j
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to