Generator Arrow Functions

David Bruant bruant.d at gmail.com
Tue Nov 12 19:58:32 PST 2013


Le 12/11/2013 18:30, Axel Rauschmayer a écrit :
> This is relevant, too: 
> http://esdiscuss.org/topic/function-declarations-with-lexical-this
>
> I'd still argue that generator arrow functions make more sense than 
> generator function declarations.
I don't have a strong opinion in this debate, but I've seen something 
relevant in Angus Croll's slides [1] recently:

   let idGenerator = (id=0) => () => id++;

   let nextFrom1000 = idGenerator(1000);
   nextFrom1000(); // 1000
   nextFrom1000(); // 1001

David

[1] https://speakerdeck.com/anguscroll/es6-uncensored?slide=42
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131112/17505ce7/attachment-0001.html>


More information about the es-discuss mailing list