I think the fact you had to write two solutions where one attach to the object the listener and another one needs a double arrow (rainbow) already shows we have a hole in the language once covered by arguments.callee.
The more you write examples, the more you convince me we are missing callee ;-) Again, this is jut my opinion. There are ways to work around this, it just feels wrong we lost the callee feature. Regards On Fri, Feb 27, 2015 at 7:48 PM, Claus Reinke <whycombina...@gmail.com> wrote: > > > nope, you are limiting your object to have only one listener per event, > I think that's not quite how reality is. You gonna lose that listeners next > time somebody use same name with the same object. > > true. For cases where that isn't enough, i assume you're thinking of > canceling from within the handler. > > Here goes another attempt, preserving identity while providing a > self-reference. > > let arg = ff=>{ > let arg = {}; > let f = ff(arg); > arg.callee = f; > return f; > }; > let f = arg=>n=>n>1?n*arg.callee(n-1):1; > console.log(arg(f)(5)); > > Perhaps i'm going to run out of ideas soon, but my point is that it is > worth looking for less powerful alternatives that achieve the same ends. > Else we'd all be writing lisp, right?-) > > Claus >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss