Re: Named Arrow Functions

2015-08-12 Thread Isiah Meadows
Oops... Used to Node world. I didn't really test it, since I replied by phone. On Wed, Aug 12, 2015, 10:46 Salvador de la Puente González < sa...@unoyunodiez.com> wrote: > AFAIK, this wont work because what clearTimeout() is actually expecting is > the id returned by setTimeout(). > El 12/8/2015

Re: Named Arrow Functions

2015-08-12 Thread Nick Krempel
This was assuming an API like addEventListener/removeEventListener, not the standard DOM setTimeout/clearTimeout, sorry for the confusion. On 12 August 2015 at 15:46, Salvador de la Puente González < sa...@unoyunodiez.com> wrote: > AFAIK, this wont work because what clearTimeout() is actually ex

Re: Named Arrow Functions

2015-08-12 Thread Salvador de la Puente González
AFAIK, this wont work because what clearTimeout() is actually expecting is the id returned by setTimeout(). El 12/8/2015 16:00, "Nick Krempel" escribió: > On 12 August 2015 at 02:56, Isiah Meadows wrote: > >> ```js >> >> let p = new Promise((resolve, reject) => >> setTimeout((x => () => x(x))(

Re: Named Arrow Functions

2015-08-12 Thread Nick Krempel
On 12 August 2015 at 02:56, Isiah Meadows wrote: > ```js > > let p = new Promise((resolve, reject) => > setTimeout((x => () => x(x))(handler => { > onNotNeeded(() => clearTimeout(handler)); > > // `return` is to take advantage of TCO > return doSomethingAsync(err => { > if (er

Re: Named Arrow Functions

2015-08-11 Thread Ron Waldon
For use cases that require named Functions (e.g. recursion), surely it's not a such a big deal to either assign an Array Function to a variable first, or use the good old trusty named Function expression or Function statement. var recurseExample = () => { recurseExample(); } var recurseExample =

Re: Named Arrow Functions

2015-08-11 Thread Salvador de la Puente González
ted inline. >> >> On Tue, Aug 11, 2015, 21:56 Isiah Meadows wrote: >> >> The real reason people need named arrow functions, the biggest use case >> is for event handlers. >> >> ```js >> let p = new Promise((resolve, reject) =>

Re: Named Arrow Functions

2015-08-11 Thread Isiah Meadows
11, 2015, 21:56 Isiah Meadows wrote: > > The real reason people need named arrow functions, the biggest use case is > for event handlers. > > ```js > let p = new Promise((resolve, reject) => > setTimeout((x => () => x(x))(handler => { > onNotNeeded(() =>

Re: Named Arrow Functions

2015-08-11 Thread Isiah Meadows
Sent this too early... Corrected inline. On Tue, Aug 11, 2015, 21:56 Isiah Meadows wrote: The real reason people need named arrow functions, the biggest use case is for event handlers. ```js let p = new Promise((resolve, reject) => setTimeout((x => () => x(x))(handler => {

Re: Named Arrow Functions

2015-08-11 Thread Isiah Meadows
The real reason people need named arrow functions, the biggest use case is for event handlers. ```js let p = new Promise((resolve, reject) => setTimeout((x => () => x(x))(handler => { onNotNeeded(() => clearTimeout(handler)); // `return` is to take advantage of

Re: Named Arrow Functions

2015-08-11 Thread Kevin Smith
> > My proposal is not a keyword, but an hidden variable included at functions > (e.g. arguments). > Does arrow functions have any limitations about that? > Yes. There are no special contextual keywords reserved within arrow functions. We've discussed the possibility of a "meta property" for thi

Re: Named Arrow Functions

2015-08-11 Thread Kevin Smith
> > x.map(factorial(x) => do { > if (x <= 1) { > 1; > } else { > x * factorial(x - 1) > } > }); > This has been discussed over the years but there has been very little interest in making the grammar more complicated. After all, you can alway

Re: Named Arrow Functions

2015-08-11 Thread Leonardo Wolter
parse in general, I don't think this >> >> would play very well with the async/await proposal >> >> https://tc39.github.io/ecmascript-asyncawait/ , which wants to have >> >> arrow functions like >> >> >> >> async (x) => ... >&

Re: Named Arrow Functions

2015-08-11 Thread Leonardo Wolter
general, I don't think this > >> would play very well with the async/await proposal > >> https://tc39.github.io/ecmascript-asyncawait/ , which wants to have > >> arrow functions like > >> > >> async (x) => ... > >> > >> Be

Re: Named Arrow Functions

2015-08-11 Thread Daniel Ehrenberg
c39.github.io/ecmascript-asyncawait/ , which wants to have >> arrow functions like >> >> async (x) => ... >> >> Because we can't count on async as a keyword, your proposal would >> create an ambiguity. >> >> On Tue, Aug 11, 2015 at 1:49 PM, Ja

Re: Named Arrow Functions

2015-08-11 Thread Leonardo Wolter
roposal would > create an ambiguity. > > On Tue, Aug 11, 2015 at 1:49 PM, Jacob Parker > wrote: > > I did look, but couldn’t find anything on named arrow functions were not > included. I do sometimes find cases where I want recursion inside a class > function definition, and

Re: Named Arrow Functions

2015-08-11 Thread Daniel Ehrenberg
would create an ambiguity. On Tue, Aug 11, 2015 at 1:49 PM, Jacob Parker wrote: > I did look, but couldn’t find anything on named arrow functions were not > included. I do sometimes find cases where I want recursion inside a class > function definition, and still need access to `this

Re: Named Arrow Functions

2015-08-11 Thread Leonardo Wolter
Woah, an actual application of Y combinator hahaha https://www.youtube.com/watch?v=FITJMJjASUs On Tue, Aug 11, 2015 at 7:01 PM James M Snell wrote: > On Tue, Aug 11, 2015 at 2:21 PM, Tab Atkins Jr. > wrote: > [snip] > > > > let Y = F => (x=>F(y=>(x(x))(y)))(x=>F(y=>(x(x))(y))); > > > > Aah

Re: Named Arrow Functions

2015-08-11 Thread James M Snell
On Tue, Aug 11, 2015 at 2:21 PM, Tab Atkins Jr. wrote: [snip] > > let Y = F => (x=>F(y=>(x(x))(y)))(x=>F(y=>(x(x))(y))); > Aahh! my eyes! it burns!!! ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Named Arrow Functions

2015-08-11 Thread Tab Atkins Jr.
On Tue, Aug 11, 2015 at 1:49 PM, Jacob Parker wrote: > I did look, but couldn’t find anything on named arrow functions were not > included. I do sometimes find cases where I want recursion inside a class > function definition, and still need access to `this`. Was it just seen as >

Named Arrow Functions

2015-08-11 Thread Jacob Parker
I did look, but couldn’t find anything on named arrow functions were not included. I do sometimes find cases where I want recursion inside a class function definition, and still need access to `this`. Was it just seen as syntax bloat, or were there any complications to implementing it