On 2008/4/10, Lars Hansen <[EMAIL PROTECTED]> 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
normative.
* 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
"itemization"?
* 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:
Object.properties(
obj: Object!,
deep: boolean = true,
withDontEnum: boolean = false,
namespaces: (boolean|Iterable.<Namespace>) = false)
: Iterable.<Name>
Either way, DEFAULT_GET is easily defined in terms of that.
-j
_______________________________________________
Es4-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es4-discuss