On Fri, Mar 23, 2012 at 12:14 PM, Allen Wirfs-Brock
<[email protected]>wrote:
>
> On Mar 23, 2012, at 12:42 AM, Claus Reinke wrote:
>
> > - 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)?
> >
>
> But its value could be accessed? It's properties could be accessed?
>
> This would be a new kind of Temporal deal zone. I don't think we need it.
> Can you show a use case were the current proposal (class X{} scopes just
> like const X;) doesn't work.
>
Yeah, this would be a pretty awkward middle phase - you could say new X(),
but not use any methods. OTOH, one possible use case would be the ability
to do inheritance out of source order.
//can still extend A because the resulting constructor is hoisted
class B extends A{...}
class A{...}
The only weird thing is wouldn't that mean you could somehow do a circular
inheritance tree?
class B extends A{...}
class A extends B{...}
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.
I think we should stick with const style hoisting. The restrictions are not
very difficult and the result is cleaner.
- Russ
>
> Allen
>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss