Finding a "safety syntax" for classes

Claus Reinke claus.reinke at talk21.com
Fri Mar 23 00:42:45 PDT 2012


> Thanks, I did catch up that far on the thread, but Allen reiterated the 
> point he'd made months ago: you can't hoist *and initialize* the class 
> declaration as you can a function declaration. Rather, class decl is 
> like const decl. That was my point.
> 
> If "hoist" means only the binding, with a TDZ protecting use before 
> in-evaluation-order init, then we agree.

I'm probably missing something, but since the current proposal
is meant to be sugar around the old constructor/prototype pattern:

- would it make sense to name the constructor after the class
    (avoiding 'constructor' and 'new')?
- could we think of hoisting a class as hoisting its constructor
    (the hoisted binding wouldn't be undefined, but shouldn't    
      be called before initialization, either)?

Claus
 


More information about the es-discuss mailing list