I'm working with TomVC right now on revising these internal methods.  More on 
that soon.

One possible advantage of using an Iterator is that large dense indexable 
objects such as typed arrays, strings, or similar abstractions defined using a 
proxy don't have to instantiate an 
Array containing huge numbers of  element indices.

Also we have talk about, the future addition of user land iterator valued 
functions such as keys, ownKeys, etc.  or the possibility of frameworks 
providing such functions.  The internal methods.  The MOP defined by the 
internal methods should provide a stable foundation for such future extensions.

Allen


On Dec 6, 2013, at 6:35 AM, Jason Orendorff wrote:

> 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
> 

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

Reply via email to