An experiment using an object literal based class definition pattern

Brendan Eich brendan at mozilla.com
Mon Aug 8 22:40:01 PDT 2011


On Aug 8, 2011, at 10:24 PM, Allen Wirfs-Brock wrote:

>>>  class superclass <| subclass () {
>>> }
>> 
>> That's so backward from other binding forms,
> we don't really have a comparable binding form in ES.  The closest comparable are function declarations and they don't really provide any guidance for this problem.

But class declarations in Python, Ruby, and other languages do provide guidance. None has this super < subclass ordering.


>     class boundSymbol : superclass () { }
> might work although, it may be confusing different from property definitions.

And guards. The colon character was used this way in some earlier drafts of classes proposals, but extends is already reserved and it's in the current draft. I don't see a good argument to replace it with something, but perhaps one will be made.


>> and from class in other languages, that it won't fly.
> 
> If required to choose I would favor internal consistency over similarity to other languages.  

There is nothing "internally consistent" about adding a binding form where the bound identifier does not immediately folllow the introductory keyword.


>> If you turned the triangle around, that would be progress.
> 
> Yes, but there are really good arguments the <| ordering, for example:

Sure, I was not seriously recommending |>.


> Yes, but we have no real evidence one way or the other that the usability  of <| and .{ is poor.  Mostly just assertions based upon minimal use.  

The usability of <| and .prototype. and the final .constructor (with .{ ... } or a ; after) is manifestly poor for defining a whole class. This is a no-brainer. Axel already got the order wrong!

/be


More information about the es-discuss mailing list