Le 29/10/2011 05:45, Brendan Eich a écrit :

On Oct 28, 2011, at 8:23 PM, Axel Rauschmayer wrote:

>> I’d be sad not to have *class literals* in JavaScript. However, with the new 
>> object literal extensions, things are still much better than in ES5. 
>> Compare: The ES5 version is clumsy.
>> The ES.next version is quite nice:
> [Snip]
>
> I have to say Allen's use of chained <| and .{ wins if you are going for a 
> "class pattern".
>
> There are lots of patterns. It still seems to me we would help more users 
> avoid mistakes by having *real class syntax*. More on that in a bit.
(emphasis added)

At the top of the classes strawman [1] is written the following:
"ECMAScript already has excellent features for defining abstractions for
kinds of things. The trinity of constructor functions, prototypes, and
instances are more than adequate for solving the problems that classes
solve in other languages. The intent of this strawman is not to change
those semantics. Instead, it’s to provide a terse and declarative
surface for those semantics so that programmer intent is expressed
instead of the underlying imperative machinery."

When I see the Triange-Monocle-Moustache combo for a class-like pattern,
it seems to me that the goal is very close to be achieved.

What do "real class literal" and "real class syntax" mean (in the
previous quotes)? What more would they achieve regarding the goal stated
in the classes strawman?

David

[1] http://wiki.ecmascript.org/doku.php?id=harmony:classes
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to