Oh, thanks.
I am sorry I had not read the proposal to the full detail.
I just thought the operator always does the same thing no matter what the
context is, but since it is not general, but tied only to some syntactic
elements on RHS ({}, [], function, ...) than it is understandable that it
can do slightly different things for them.
I also apologize to those authors whom I charged with incorrect use of <|.
It was me who was mistaken.
Herby
-----Pôvodná správa-----
From: Brendan Eich
Sent: Friday, December 16, 2011 9:57 PM
To: Herby Vojčík
Cc: es-discuss@mozilla.org
Subject: Re: <| ambiguity
No problem with re-posting a reply that you meant to be a reply-all.
For the case of
ClassConstructorFunction <| function (...) {...}
the proposal does something exra: it makes the RHS.prototype (the
'prototype' property of the RHS) delegate via that object's [[Prototype]]
internal property to ClassConstructorFunction.prototype. So you get the
parallel prototype and class-side inheritance:
RHS --[[Prototype]]--> ClassConstructorFunction --[[Prototype]]-->
Function.prototype
RHS.prototype --[[Prototype]]-->
ClassConstructorFunction.prototype --[[Prototype]]--> Object.prototype
(assuming ClassConstructorFunction is a user-defined function whose
.prototype is a fresh Object instance, as usual).
/be
----- Original Message -----
From: "Herby Vojčík" <he...@mailbox.sk>
To: es-discuss@mozilla.org
Sent: Friday, December 16, 2011 12:03:48 PM
Subject: Re: <| ambiguity
Hello,
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")
Herby
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).
/be
----- Original Message -----
From: "Herby Vojčík" <he...@mailbox.sk>
To: "Brendan Eich" <bren...@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
here.)
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.
Herby
-----Pôvodná správa-----
From: Brendan Eich
Sent: Friday, December 16, 2011 7:43 PM
To: Herby Vojčík
Cc: es-discuss@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
right.
/be
----- Original Message -----
From: "Herby Vojčík" <he...@mailbox.sk>
To: es-discuss@mozilla.org
Sent: Friday, December 16, 2011 9:57:45 AM
Subject: <| ambiguity
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?
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss