Finding a "safety syntax" for classes

Russell Leggett russell.leggett at gmail.com
Thu Mar 22 23:14:47 PDT 2012


On Fri, Mar 23, 2012 at 1:38 AM, Brendan Eich <brendan at mozilla.org> wrote:

> 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.
>

Yes, hoisting just the binding is really the only way to avoid stalling
out. I think it is easy to reason about, works as desugaring, and hits the
90% case.


>
> I'm pretty happy with the thread, and with Allen's strawman based on your
> suggestion and Dave's minimal classes work. Thanks!
>
>
No problem. I keep hearing you say you have doubts about classes making it,
and it is easy to see why - and yet I think everyone would like at least
this most minimal classes.

"The quest stands upon the edge of a knife. Stray but a little and it will
fail. But hope remains, if friends stay true."

I have hope :)

- Russ


> /be
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120323/8da1c2e2/attachment.html>


More information about the es-discuss mailing list