Consistently extending object literals into "class" literals was one of the
goals of this particular design but that goal isn't a requirement. At the
latest TC39 meeting some participants expressed an opinion that the prototype
specification for an object literal should go outside of the brackets.
http://wiki.ecmascript.org/doku.php?id=strawman:proto_operator presents one
possible design for that approach. If object literals designs evolve in this or
other directions then it may be less important to maintain consistency between
object literals and class declarations.
Another thing I haven't seen mentioned on this thread, is that my class
declaration proposal supported both proto: and superclass: as alternatives
metaproperties with different semantics. There seems to be valid use cases for
each. It may not be necessarily to have both but in exploring alternatives
that possibility should continue to be considered.
On Mar 27, 2011, at 1:05 PM, Brendan Eich wrote:
> Do we really need to look different yet still have bones that look so
> familiar? I am not convinced.
>
> The strongest case for extending initialiser syntax is that it is "nearly
> declarative" today. That suggests strongly making the extension fully
> declarative, i.e., not usable as an expression. And that, all else equal
> (never is, but:) says to consider class D extends B {...}. My 2 cents.
>
I don't think "declarative" should not be equated with "not usable as an
expression " or introduces a lexical binding. When I say declarative I mean a
non-constructive (or non-imperative) definition of the desired value. 3 is
declarative, 2+1 isn't. Some people describe this difference as "what, not
how". Both function declarations and function expressions are both declarative
definitions of functions even though one creates a local binding and the other
can be used as an expression. In my proposal, the same distinction was applied
to class definitions. There was both a statement and expression form, largely
for consistency with functions. I don't think this distinction has much, at
all, to do with the syntax for specifying the superclass or prototype.
Allen
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss