On Nov 17, 2011, at 5:13 AM, Russell Leggett wrote:

> Look closer - it is being used as a prefix operator, not an infix operator.
> 
>     extends Proto {...}

There have been a few alternatives discussed in the previous thread. IMO, in 
each one of them, `extends` is awkward. The one you're talking about:

    extends p { foo: 1, bar: 2, baz: 3 }

is stilted -- English is SVO (subject-verb-object) not VSO. We don't say "loves 
JavaScript Russ" but rather "Russ loves JavaScript." Plus we don't have any 
binary prefix expression operators in JS so that sticks out, too.

If it's infix, you have to make `extends' RTL:

    { foo: 1, bar: 2, baz: 3 } extends p

As I said in response to Axel, LTR is preferable in JS.

But finally, there's the grammatical issue: `extends` makes sense as part of 
either a declaration or a boolean operator. In a declaration we'd be declaring 
*that* X extends Y. In a boolean operator we'd be asking *whether* X extends Y. 
But what we're talking about here is an operator for constructing a new object: 
the result of X extended *with* Y. Grammatically, extendedwith or extendedby 
would fit better, but of course look terrible.

> This works well with any of the proposal "class as operator"
> 
>     class extends Proto {...}
> 
>     class Point2d extends Point {...} 

I'm not tying my suggestion to classes at all. I like classes fine, and don't 
think they need to be built up from tiny lego pieces. We can use `extends` as 
part of the class syntax without having to have `extends` mean something on its 
own.

Dave

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to