On Mon, Oct 3, 2011 at 9:37 PM, Erik Arvidsson <[email protected]> wrote:
> On Mon, Oct 3, 2011 at 17:25, Brendan Eich <[email protected]> wrote:
>> If so we are at an impasse. To get past it, we would need to agree on
>> declarative syntax and semantics preventing use before initialization. We
>> can try to do that again, see if anyone has changed minds.
>
> I don't agree that we need to agree on a semantic that prevents use
> before initialization for ES.next. Like I've previously stated both
> Python and ES5 gets by without this.
>
> The proposal we were talking about (last hour of the F2F) was
> something even simpler than what we have at the wiki. It did involve
> using object literal for the class body and no special form for the
> constructor. This makes things simpler but the main downside with that
> is that it is not as easily extended to add const and whatever feature
> we might want in the future.
I don't want to be pushy, so this is the last time that I'll mention
it, but if we can create something using the <| operator that can
basically do what has been discussed for the simplest class literal,
but without the class keyword, it would leave the door open for a
future spec. This was was my proposal from before:
const ClassName = SuperClass <| {
constructor(/*constructor parameters */) {
//constructor body
super.constructor(/*arguments to super constructor */);
this.{
//per instance property definitions
}
}
method1(){ return super.method1(); }
method2(){}
prop1:"Properties unlikely, but allowed"
}.{
//class properties
staticMethod(){}
};
Where SuperClass is a constructor function, so LHS: function, RHS:
object literal == class without the keyword. In the most common case,
there wouldn't be any "static" methods/properties so you normally
wouldn't even need the slightly awkward use of '.{' here.
- Russ
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss