Finding a "safety syntax" for classes

Allen Wirfs-Brock allen at wirfs-brock.com
Fri Mar 23 09:59:17 PDT 2012


On Mar 23, 2012, at 9:48 AM, Russell Leggett wrote:

> ...
> That should probably not be legal but begs the question how does extension fit into hoisting. Would this work?
> 
>     class C extends B{...}
>     class B extends A{...}
>     class A{...}
> 
> Desugaring extension into <| would force it back into an assignment expression again instead of a function declaration, so following that logic, only A would be hoisted in my last example, and so class C would fail.


A wouldn't initialize early  either.  If class C extends B is treated as const C=B <| function() {} then for consisteny we must treat class A{}; as const A=function() {}

> 
> I think we should stick with const style hoisting. The restrictions are not very difficult and the result is cleaner.

exactly

Allen




More information about the es-discuss mailing list