David Herman wrote:
On Mar 24, 2012, at 3:01 PM, Nadav Shesek wrote:
What about setting arbitrary expressions as the value for prototype methods? Being able
to use higher-order functions to dynamically create functions is very important for
functional style programming. I use it very often to decorate functions, compose
functions together, set partially applied functions as methods, etc. It seems to be
impossible with syntax proposed here - I think adding it to the "safety syntax"
is very much needed and should not be over looked.
Yep, we already agreed to this -- see the grammar on Allen's "maximally
minimal" proposal:
http://wiki.ecmascript.org/doku.php?id=strawman:maximally_minimal_classes#class_declarations_and_expressions
I don't see what I read Nadav as asking for: the ability to initialize a
prototype method from an arbitrary expression. What am I missing?
Class bodies
ClassElement :
PrototypePropertyDefinition
; //semicolons are allowed but have no significance
PrototypePropertyDefinition :
PropertyName ( FormalParameterList? ) { FunctionBody } // method
*PropertyName ( FormalParameterList? ) { FunctionBody } // generator
method
get PropertyName ( ) { FunctionBody } // getter
set PropertyName ( ProopertySetParameterList ) { FunctionBody } // setter
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss