Extended Object Literals to review

Juan Ignacio Dopazo dopazo.juan at gmail.com
Sat Mar 12 09:44:47 PST 2011


>
> (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/d74c43ea/attachment-0001.html>


More information about the es-discuss mailing list