I'm not pointing out an issue in particular, just explaining why Andy
is right with his specific statement about implementations not using
generators (which Dave seemed surprised about, or have misread, I'm
not sure).

(You are right to assume that built-in iterators would not need .return.)

/Andreas


On 30 April 2014 16:03, Mark S. Miller <erig...@google.com> wrote:
> I don't think I understand the issue. AFAICT, all the system implemented
> iterators don't need to clean up anything that's not already cleaned up by
> GC, so they wouldn't need a .return method anyway. Is there a
> counter-example?
>
>
> On Wed, Apr 30, 2014 at 3:48 AM, Andreas Rossberg <rossb...@google.com>
> wrote:
>>
>> On 29 April 2014 20:35, David Herman <dher...@mozilla.com> wrote:
>> > On Apr 29, 2014, at 12:40 AM, Andy Wingo <wi...@igalia.com> wrote:
>> >> Indeed I expect that in
>> >> practice most iterators in an ES6 program will be map, set, and array
>> >> iterators, which in practice will not be implemented with generators.
>> >
>> > I strongly disagree with this. Generators will by far be the most
>> > convenient and common way to implement iterators, regardless of their data
>> > source.
>>
>> Yes, but Andy was talking about VM-provided iterators, where
>> convenience of implementation does not matter. It is safe to assume
>> that for all VMs a generator-based implementation will be
>> substantially more expensive than a hand-written one (and will remain
>> so in the foreseeable future, I'm pretty sure of that -- e.g. inlining
>> is tricky for generators). So VM implementers won't use generators
>> internally.
>>
>> /Andreas
>
>
>
>
> --
>     Cheers,
>     --MarkM
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to