prototype for operator proposal for review

Brendan Eich brendan at mozilla.com
Wed May 18 09:20:34 PDT 2011


On May 18, 2011, at 9:10 AM, Allen Wirfs-Brock wrote:

> On May 18, 2011, at 12:41 AM, Dmitry A. Soshnikov wrote:
> 
>> On 18.05.2011 6:50, Allen Wirfs-Brock wrote:
>>> 
>>> We had so much fun with feedback on my Unicode proposal I just have open another one up for list feed back:
>>> 
>>> An updated version of the "prototype for" (formerly proto) operator proposal is at http://wiki.ecmascript.org/doku.php?id=strawman:proto_operator 
>>> 
>> 
>> Just a small note on:
>> 
>> "There are many other possible special character alternates to <|. For example, |>, ^^, *>, &>, ^|, <|-, etc. It isn’t clear that any of these is more meaningful or mnemonic than <|."
>> 
>> Perhaps just "less than" would be enough? Why we need two symbols? It's by the way, a real implementation of subclassing in Ruby:
> 
> < already has a meaning for operands that are arbitrary objects.  It applies valueOf and/or toString to the operands and then compares the results.

Indeed :-P -- see http://github.com/tobeytailor/def.js/blob/master//def.js and read the source.


> Overall, <| seems like a simpler solution that is more general for the most important use case.

I like it, it's more general and it doesn't require guessing games by readers and optimizers about the meaning of "Object", "Object.make", etc.

The only thing that nags is the proto being on the left of the "triangle-arrow". Other languages and type theory use < or <: to put the extension or more-derived thing on the left, but here the extension (value not type, but still) is on the right.

Maybe I'll get over this, though. The use-case with an object literal as the extension really must be on the right, I quite agree. Does |> work any better?

/be

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110518/e7effd3a/attachment.html>


More information about the es-discuss mailing list