I created a simple example and there the two different literals shared the same map. // florian
On Sun, Apr 15, 2012 at 3:47 PM, Kobie Maitland <[email protected]> wrote: > I've been looking through the docs and various discussions but I have yet to > see an answer to these two questions that I have: > 1. Do literally defined objects with the same structure (ex: {a: 1, b:'hat'} > and {a:7, b:'shoes'}) use the same hidden class? > 2. If the answer to (1) is no: Would a dynamic constructor work? > Example of what I mean by a dynamic constructor... > function ObjFromLiteral(literal) { > for(prop in literal) { > this[prop] = literal[prop]; > } > return this; > } > var O1 = new ObjFromLiteral({a: 1, b:'hat'}); > var O2 = new ObjFromLiteral({a:7, b:'shoes'}); > Would they then share a hidden class? > > -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users -- Give a man a fire and he's warm for the whole day, but set fire to him and he's warm for the rest of his life. - Terry Pratchett -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
