ES4 draft: enumerability
jason.orendorff at gmail.com
Tue Apr 22 14:06:58 PDT 2008
On 2008/4/10, Lars Hansen <lhansen at adobe.com> wrote:
> Here's the first draft explaining how enumeration works in ES4.
* It's unclear which parts of this, if any, are intended to be
* Are the terms "enumeration", "iteration", and "itemization" defined
somewhere? Even if they are, I can't stop reading the first two as
synonyms, so I'd welcome a change in terminology. Perhaps "for-in
iteration" for "enumeration", and "for-each-in iteration" for
* The treatment of for-each-in (the last sentence) is a bit vague. The
only difference is how the iterator "IT" is obtained, right? But that
needs to be specified.
Renaming "GET" and "DEFAULT_GET" to something like
"FOR_ITERATOR" and "DEFAULT_FOR_ITERATOR" would leave room for
"FOR_EACH_ITERATOR" and "DEFAULT_FOR_EACH_ITERATOR".
* The iterator proposal specifies additional special behavior when the
iterator "IT" is a generator-iterator. Intentionally omitted here?
* Is a more general introspection facility planned? If so, I hope
DEFAULT_GET can be defined in terms of that and the Enumerator class
can be dropped.
* The design of Enumerator doesn't make sense to me, especially that
it's a parameterized class. What's the design goal here?
To expose "get obj's public, enumerable properties, just like ES3
for-in", a static method suffices:
Object.getEnumerableProperties(obj: Object!): Iterable.<string>
If the goal is to expose a general API for getting various slices of
an object's set of property names, a static method still suffices:
deep: boolean = true,
withDontEnum: boolean = false,
namespaces: (boolean|Iterable.<Namespace>) = false)
Either way, DEFAULT_GET is easily defined in terms of that.
More information about the Es4-discuss