Check out Dart's iterators
Jason Orendorff
jason.orendorff at gmail.com
Mon Feb 11 08:54:48 PST 2013
On Sun, Feb 10, 2013 at 4:05 PM, Oliver Hunt <oliver at apple.com> 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?
>
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.
-j
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130211/78ef9d5b/attachment.html>
More information about the es-discuss
mailing list