Creating and consuming custom iterators

Axel Rauschmayer axel at
Wed Aug 28 00:34:25 PDT 2013

> 1 There's no way I can create custom iterator abstraction (How can I can
> define MyCustomIterator.prototype[@@iterator] method?).
> 2. There's no straightforward way to consume iterators in generic way, e.g.
> I want to write function that works in similar way as Set constructor, and
> accepts any iterator implementation. I don't have a means to call
> iterator[@@iterator] method.
> Please correct me if I'm wrong, but if it's the case, I think it's really
> important to open that.
> Maybe there should be Reflect.getIterator(obj) and
> Reflect.defineIterator(obj, getIterator) for that?

There will be a public symbol (that you can import from a system module) that will allow you to do both things.

Dr. Axel Rauschmayer
axel at


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

More information about the es-discuss mailing list