Finding a "safety syntax" for classes

Russell Leggett russell.leggett at gmail.com
Wed Mar 21 09:01:57 PDT 2012


>
>
>
>
>> Anyway, unless we are going to really make classes distinct from
>> functions, I'm not sure how we could enforce super in the way you describe
>> without affecting it in other forms. Can you only extend classes created
>> using "class" syntax?
>>
>
> No - any function (constructor) can be to the right of "extends".  Again,
> not necessarily arguing the case either way, but if in some future there
> were field initializers then they would presumably be at the top of the
> desugared constructor:
>
> function _ctor(a, b, c) {
>     // super constructor call?
>     // execute field initializers
>     // "new" / "constructor" body
> }
>

Yeah, I guess I just meant that we still have to handle old ways of wiring
up classes. Lets say we made a class with field initializers and then
extended it with a function, but didn't use the class syntax, wouldn't that
break the integrity you're trying to reinforce? I just think its a ball of
wax that we can deal with later, and leave this as more sugar over existing
semantics.

- Russ


>
> kevin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120321/718e6bfd/attachment-0001.html>


More information about the es-discuss mailing list