Finding a "safety syntax" for classes

Brendan Eich brendan at
Sat Mar 24 19:29:06 PDT 2012

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:

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 :
     ;           //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


More information about the es-discuss mailing list