Generator Arrow Functions

Irakli Gozalishvili rfobic at gmail.com
Wed Nov 20 02:59:58 PST 2013


+1 on arrowed generators! Have being actively using generators last month &
have being wishing they could be like arrows, although syntax I've being
thinking of was

(x, y) *> { .... }

BTW given that generators are used as a method on iterators wouldn't it
make sense to consider syntax for generator members in a classes syntax ??
My hope is in ES6 we would just use class syntax for methods & arros for
functions making "function" a legacy

On Monday, November 18, 2013, Brendan Eich wrote:

> Ѓорѓи Ќосев 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
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>


-- 
Regards
--
Irakli Gozalishvili
Web: http://www.jeditoolkit.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131120/cd6861a3/attachment.html>


More information about the es-discuss mailing list