Finding a "safety syntax" for classes

Brendan Eich brendan at mozilla.org
Thu Mar 22 22:38:49 PDT 2012


Russell Leggett wrote:
> This is what Allen said about hoisting for this spec (Its been a long 
> thread, not sure if you missed this.):

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.

If hoist means (as I used it, and even the words from Allen you quote 
do, viz "hoisting class definitions and immediately initializing them 
the way we do with functions just doesn't work...") moving the 
initiialization up too, then that misorders expression evaluation.

I'm pretty happy with the thread, and with Allen's strawman based on 
your suggestion and Dave's minimal classes work. Thanks!

/be


More information about the es-discuss mailing list