Can you show an example of how callee is used with a fat arrow function?
((n)=>n>1? n*function.callee(n-1) : 1)
meta-level tools are powerful, which makes them ever so tempting.
They are too powerful to be used for tasks for which current
language-level tools are sufficient. Using a call-by-value
fixpoint combinator
let fix = f=>x=>f(x=>fix(f)(x))(x)
undefined
we can use plain functional abstraction instead of meta properties
let f = self=>n=>n>1?n*self(n-1):1
undefined
fix(f)(6)
720
fix(f)(7)
5040
(if you're worried about optimization, provide a built-in 'fix')
For concise methods, the problem is already solved by 'this',
isn't it?
({f(n){return n>1?n*this.f(n-1):1}}.f)(6)
720
Like most powerful tempting things, referring to meta-levels comes
at a cost, even though that may not be immediately visible (ie no
lexical scoping, cannot extract as part of a function body). So the
easiest route (of introducing the most powerful feature) is not
necessarily the best route.
You're still working to get rid of anomalies that hamper functional
abstraction and composition (arrow functions help with 'this'; and
wasn't the missing toMethod an attempt to handle the newly
introduced 'super' special case?). I'm surprised to see everyone
so eager to introduce new trouble.
just saying... :-)
Claus
http://clausreinke.github.com/
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss