News for hackers. Stuff that matters.
Re:Google Releases JavaScript.next to JavaScript Compiler Tr... by Luyt on Wednesday May 04, 2011 @03:26AM (#2513052)
"You can also create your own iterable objects. Normally this is done via the yield keyword (discussed below in Generators) but it could be done explicitly by returning an object that has __iterator__"

This clearly seems to be borrowed from Python; even the double underscores are present, which looks a little odd in javascript.

Re:Google Releases JavaScript.next to JavaScript Compiler Tr... by tlrobinson on Wednesday May 04, 2011 @04:14AM (#2513139)
There is a precedent for double underscores in JavaScript, for example the __proto__ property. However that convention is usually reserved for private APIs, which arguably __iterator__ isn't.
Re:Google Releases JavaScript.next to JavaScript Compiler Tr... by msy on Wednesday May 04, 2011 @04:56AM (#2513211)
The double underscore syntax is used in Javascript already for getters and setters: this.__defineGetter__
Re:Google Releases JavaScript.next to JavaScript Compiler Tr... by munificent on Wednesday May 04, 2011 @11:14AM (#2514068)
The naming here comes from Mozilla's earlier implementation (https://developer.mozilla.org/en/JavaScript/Guide/Iterators_...). Personally, I would have preferred iterate().

Traceur doesn't use the same Python-style semantics as Mozilla does: it doesn't throw an error to stop iteration. Instead, it's closer to Java or C# where moveNext() returns false if the iterator is done.