An "extend" operator is a natural companion to <|

Allen Wirfs-Brock allen at wirfs-brock.com
Tue Jul 19 12:39:10 PDT 2011


On Jul 19, 2011, at 12:10 PM, Brendan Eich wrote:

> On Jul 19, 2011, at 11:39 AM, Allen Wirfs-Brock wrote:
>> 
> 
> 
>> The third column uses Object.specialize and Object.extend calls instead of <| and <&.
>> 
>> Note that Object.create can't be used instead of Object.specialize because I want the second argument to be a regular object literal rather than a property descriptor.
> 
> "specialize" is ambiguous with respect to copying vs. delegating. How about Object.delegate(to, from)? Or Object.clone, a Self homage?
> 
> It's hard to love the keyword forms, and many clearly choke on the punctuator stew. That plus the "usable from downrev scripts" lends weight to Object.{clone,extend}.

I didn't expect any of the chosen words to stick, I think the visual shape of the code for the four alternatives is more interesting.  From that perspective I find that my eyes are more able to distinguish <| and <& as unique indicators that something important is happening near them.

WRT, the various words.  Their English meanings are simply hints (and for non-native speakers probably poor hints) at the actual specified meaning of each operator/function.  In my case, the concept that things down an inheritance hierarchy are more specialized and that things up the hierarchy are more generalized is deeply ingrained that "specialize" works as a very strong hint for me.  But that is a pretty geeky OO perspective and it might not work so well for others. Self use of clone has never seemed intuitive to me.  Clone to me is much more suggestive of a shallow copy.

Allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110719/7fe04112/attachment.html>


More information about the es-discuss mailing list