On Tue, Mar 20, 2012 at 3:30 PM, Kevin Smith <[email protected]> wrote:
> class Snake extends Animal {
>>>
>>> constructor(name){
>>>
>>> super(name);
>>>
>>> }
>>>
>>> Another option here would be:
>
> class Snake extends Animal {
> // Using "new" ; )
> new(name) : super(name) {}
> };
>
> Note the call to the super constructor before the body of the constructor.
> This is similar to C#. The reason that we might want to go that way is
> because if we wanted to have instance initializers in the class body (a
> very common thing in class-based languages), then we'd want to maintain
> this order:
>
> 1. Call superclass constructor
> 2. Execute instance property initializers in text order
> 3. Execute constructor body
>
Yeah - Java enforces this by making it an error if a call to super happens
after any other statement. I think it makes sense, but does it belong in
the safety syntax? Let's keep anything innovative out - that will
inevitably lead to controversy.
- Russ
>
> kevin
>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss