Extended Object Literals to review

Allen Wirfs-Brock allen at wirfs-brock.com
Sat Mar 12 10:49:06 PST 2011


I've added basic desugaring patterns to the class initialisers wiki page to clarify things.

On Mar 12, 2011, at 9:44 AM, Juan Ignacio Dopazo wrote:

> (note correction in function c() {} example below.  the Object.create is an essential part of the semantics)
> 
> That makes complete sense! So the resulting prototype will be a new object. Perfect!
> 
>> Why were class bodies chosen as object initializers instead of function bodies?
> 
> In order to provide a declarative form  for the conventional constructor/prototype/instance "class" definition pattern.  In a declarative form you (or an implementation) can determine the initial "shape" of the objects (the complete set of properties) without having to either simulate  execution of the constructor or wait until runtime and observe actual execution of the constructor
> I thought that would be the point, but I wasn't sure. Sounds great.
> 
> Thanks for clarifying my doubts!
> 
> Juan

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


More information about the es-discuss mailing list