Generator Arrow Functions

Claude Pache claude.pache at gmail.com
Tue Nov 26 14:28:03 PST 2013


Le 18 nov. 2013 à 19:38, Brendan Eich <brendan at mozilla.com> a écrit :

> Ѓорѓи Ќосев wrote:
>> Its harder to scan whether this is a generator arrow function or a normal arrow function because the star is too far away:
>> 
>>    someFunction(*(someArgument, anotherArgument) => {
>>        ... code ...
>>    });
>> 
>> compared to this form, where its immediately obvious that this is not a regular function, just by looking at the composed symbol (arrow-star)
>> 
>>    someFunction((someArgument, anotherArgument) =>* {
>>        ... code ...
>>    });
> 
> I buy it. This is what I'll propose next week as concrete syntax. It's a small point, but the rationale is "the star goes after the first token that identifies the special form as a function form." For generator functions, that token is 'function'. For arrows, it is '=>'.
> 
> /be

From the thread [1], I guess that parsing correctly the following thing would be obnoxious (at best)?

	(a = yield/b/g) =>* {}

—Claude

[1]: http://esdiscuss.org/topic/generators-grammar-and-yield


More information about the es-discuss mailing list