David Bruant (2013-11-13T03:58:32.000Z)
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>
forbes at lindesay.co.uk (2013-11-19T12:03:16.768Z)
I don't have a strong opinion in this debate, but I've seen something 
relevant in [Angus Croll's slides](https://speakerdeck.com/anguscroll/es6-uncensored?slide=42) recently:

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

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