Iterator current/prev value

Bill Frantz frantz at
Sun Mar 23 14:00:33 PDT 2014

On 3/23/14 at 11:24 AM, brendan at (Brendan Eich) wrote:

>Marcus Stade wrote:
>>This is assuming that the `current` or `prev` property is 
>>indeed implemented by the engine and not user land, as that 
>>indeed both carries implementation cost and the risk out 
>>running out of sync. Is there any way other than generator 
>>functions to implement iterators? Are any ol' object with a 
>>function called `next` an iterator?
>Any old object. It's a structural or "duck-typed" protocol.
>We won't therefore be adding complexity, which is also bad on 
>its own. KISS wins here. More elaborate protocols for harder or 
>let's say rarer cases are fine and not part of the mandatory minimum.

It seems it should be easy for any user or library to introduce 
in generalized intermediate object which implements the 
`current` or 'prev' property, so it doesn't need to be in the language.

Cheers - Bill

Bill Frantz        | Truth and love must prevail  | Periwinkle
(408)356-8506      | over lies and hate.          | 16345 
Englewood Ave |               - Vaclav Havel | Los Gatos, 
CA 95032

More information about the es-discuss mailing list