Harmony object literals

Kam Kasravi kamkasravi at yahoo.com
Mon Jun 6 11:04:18 PDT 2011


Yes, I did read the rational and see why you put it first, though the cleanest IMHO is
var  o = {
       prototype : myProto,
       a:0,
       b: function () {}
  }
Or perhaps

var  o = {
       prototype = myProto,
       a:0,
       b: function () {}
  }
Though I imagine the grammar impact for ObjectLiteral and ArrayLiteral for the latter would be onerous.


On Jun 6, 2011, at 10:32 AM, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:

> 
> On Jun 6, 2011, at 9:38 AM, Kam Kasravi wrote:
> 
>> I see, the object's prototype is to the left of <| and the actual object is to the right. I guess that was made clear in the proposal though I suspect others will invert the relationship since javascript programmers are used to defining the prototype after defining the object. The <| operator seems like you're piping something into a target rather than the other way around, you know like the shell < operator. Thanks for the clarifications.
>> 
> 
> The primary reason is that the actual object must be a literal form and if the order was reversed the <|  (or perhaps |>) and prototype value would be visually lost at the end of a long literal.  It's too important to come at the end.
> 
> 
> var myObject = {
>     //a page of property definitions...
>     //a page of property definitions...
>     //a page of property definitions...
>     //a page of property definitions...
>     //a page of property definitions...
>     //a page of property definitions...
>     //a page of property definitions...
>     //a page of property definitions...
>     //a page of property definitions...
>     //a page of property definitions...
>     //a page of property definitions...
>     //a page of property definitions...
>     //a page of property definitions...
>     //a page of property definitions...
>     } |> myProto;
> 
> Allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110606/4ec53d25/attachment-0001.html>


More information about the es-discuss mailing list