<| ambiguity

Herby Vojčík herby at mailbox.sk
Fri Dec 16 09:57:45 PST 2011


Hello,

I have read some articles on wiki.ecmascript.org as well as some post here.
It seems <| operator (which I only recently understood that it was probably 
meant to be the generalization arrow hollow top turned sideways :-) ) is 
used two ways.

As I understand, it was proposed (and I am with this semantics) so as
  proto <| obj
is roughly equivavlent with
  Object.create(proto)... // with elements of obj added

But I saw many uses like

  Car <| { ... }
  Car <| class Truck {...}
  Truck <| { ... }

where Car and Track are classes (constructor methods), not prototypes.

So which is the right semantics?

Thanks, Herby

P.S.: Maybe have two operators, <| for Object.extend semantics and <<|, <|| 
or <|= for the "raw instantiating" / subclassing one? 



More information about the es-discuss mailing list