Check out Dart's iterators

Jason Orendorff jason.orendorff at
Mon Feb 11 08:54:48 PST 2013

On Sun, Feb 10, 2013 at 4:05 PM, Oliver Hunt <oliver at> wrote:

> It turns out (at least in Python) that while you rarely have to directly
> implement the raw iterator protocol, you seriously almost *never* have to
> directly consume it. So it was the right design decision, in Python at
> least, to optimize the protocol for ease of use on the *implementing* side.
> Sorry, I don't follow what you're saying here - which implementer? the
> language implementer or the developer?


> using the python example below your iterator would be:
> function myCustomGenerator() {
>     while (line = this.readline())
>        yield line
> }

Agreed. The raw iterator protocol only ever matters if you're trying to
avoid the generator overhead or something.

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

More information about the es-discuss mailing list