yield and new : SpiderMonkey and the draft Spec
Brendan Eich
brendan at mozilla.com
Tue Mar 15 13:01:05 PDT 2011
Sorry, this is both foolish consistency and a boilerplate tax on users. Worse, it removes a special form (syntax dedicated to a new primitive) that implementations need to parse, in order to compile and optimize the function using the primitive. We are not going to add a Generator constructor.
/be
On Mar 15, 2011, at 1:16 PM, "John J. Barton" <johnjbarton at johnjbarton.com> wrote:
> On 11:59 AM, David Herman wrote:
>>> P.S.:
>>>
>>> A small change, e.g. can be to make next as a getter since it doesn't accept arguments.
>>>
>>> g.next; // 1
>>> g.next; // 2
>>>
>>> But, it's a cosmetic and actually not so needed change.
>> -1
>>
>> The purpose of the next interface is to change the state of the iterator. A getter interface obscures the statefulness.
> Yes! An API inconsistent with the rest of the language makes programming more difficult. The implicit constructor for generators obscures the nature of the generator object: same principle.
>
> jjb
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
More information about the es-discuss
mailing list