<| ambiguity

Herby Vojčík herby at mailbox.sk
Fri Dec 16 12:03:48 PST 2011


of course it does matter, when taken as a whole. I just wanted to say that 
the actual problem I was trying to address, that <| is to be used with 
prototypeObject, not with ClassConstructorFunction on the left side, is a 
problem if the left side, and literal (or not) is the right-side, which is 
another topic.

(and sorry for the mistake I only posted the previous mail to you not to the 
list since I clicked on "Reply" not "Reply to all")


P.S.: and it seems I slipped the word, too, "I would like to see it a 
little" should be "I would like to see it a little extended". :-/

-----Pôvodná správa----- 
From: Brendan Eich
Sent: Friday, December 16, 2011 8:55 PM
To: Herby Vojčík
Subject: Re: <| ambiguity

Literal does matter, because otherwise (non-literal) the operator would 
mutate the RHS's [[Prototype]] internal property, or else do an unspecified 
"clone" of the RHS (which is hard to specify and implement, and which is 
*not wanted* in the case of literal RHS forms).


----- Original Message -----
From: "Herby Vojčík" <herby at mailbox.sk>
To: "Brendan Eich" <brendan at mozilla.com>
Sent: Friday, December 16, 2011 11:41:06 AM
Subject: Re: <| ambiguity

Ok, literal or not, it does not matter (for this issue).
(I would like to see it a little (just a little, but it does not go against
the idea that it is only used when object are created, not on already living
object) in my class proposal that I posted here, but it is not a topic

What I objected against is its use in forms class <| literal, that is,
constructorFunction <| literal as opposed to prototypeObject <| literal.

I saw it in a number of posts here.


-----Pôvodná správa----- 
From: Brendan Eich
Sent: Friday, December 16, 2011 7:43 PM
To: Herby Vojčík
Cc: es-discuss at mozilla.org
Subject: Re: <| ambiguity

Please see http://wiki.ecmascript.org/doku.php?id=harmony:proto_operator --
the <| operator grammatically requires only literal object forms on its


----- Original Message -----
From: "Herby Vojčík" <herby at mailbox.sk>
To: es-discuss at mozilla.org
Sent: Friday, December 16, 2011 9:57:45 AM
Subject: <| ambiguity


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?

es-discuss mailing list
es-discuss at mozilla.org

More information about the es-discuss mailing list