Iterator current/prev value

2014-03-23 Thread Marcus Stade
Could the iterator protocol be extended to also have a `current` or `prev` property, which contains the result of the previous call to `next`? If `next` has never been called, presumably this property would return `undefined`. I've searched the archives for this question, and the only

Re: Iterator current/prev value

2014-03-23 Thread Brendan Eich
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

Re: Iterator current/prev value

2014-03-23 Thread David Bruant
Le 23/03/2014 19:24, Brendan Eich a écrit : 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

Re: Iterator current/prev value

2014-03-23 Thread Marcus Stade
On Sun, Mar 23, 2014 at 7:37 PM, David Bruant bruan...@gmail.com wrote: Any old object. It's a structural or duck-typed protocol. I see, this was the bit of insight I was missing. Thanks! -- Marcus ___ es-discuss mailing list es-discuss@mozilla.org

Re: Iterator current/prev value

2014-03-23 Thread Bill Frantz
On 3/23/14 at 11:24 AM, bren...@mozilla.org (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