> It seems easy enough to define a class that has a @@iterator() {return this} 
> method and then to subclass class it for you specific Iterables.


One more thing that might be problematic with the current approach: If you 
create combinators for iterators (similar to Python’s itertools [1]) then the 
returned iterators also need to implement this pattern. Otherwise, for-of 
couldn’t iterate over them. Example:

    for(let elem of filter(keys(myObj), x => x.length > 0)) {
    }

Thus, the pattern becomes the norm instead of the exception. Then again, maybe 
that’s not a big deal, either.


[1] http://docs.python.org/3/library/itertools.html

-- 
Dr. Axel Rauschmayer
[email protected]

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

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

Reply via email to