generator function requirements

Rick Waldron waldron.rick at gmail.com
Mon Apr 13 04:10:21 UTC 2015


On Sun, Apr 12, 2015 at 8:08 PM Mark Volkmann <r.mark.volkmann at gmail.com>
wrote:

> Thanks! I suspected that, but wanted to confirm it. Do you see in the spec
> where is says that generators are required to implement both of those
> interfaces?
>

Yep, you're looking for "Generator Objects"
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-objects


Rick


>
> On Sun, Apr 12, 2015 at 6:53 PM, Rick Waldron <waldron.rick at gmail.com>
> wrote:
>
>>
>>
>> On Sun, Apr 12, 2015 at 11:59 AM Mark Volkmann <r.mark.volkmann at gmail.com>
>> wrote:
>>
>>> I couldn't find this in spec. Is it required for generator functions to
>>> return an object that is both iterable (has Symbol.iterator method) and an
>>> iterator (has next method). It seems Babel does this, but I want verify
>>> whether that is required.
>>>
>>
>> The object that's returned by a generator function conforms to both the
>> Iterator and Iterable interfaces.
>>
>> -
>> https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iterable-interface
>> -
>> https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iterator-interface
>>
>> Rick
>>
>>
>
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150413/4bb46345/attachment.html>


More information about the es-discuss mailing list