Deep cloning objects defined by JSON.

gaz Heyes gazheyes at gmail.com
Sun Jan 22 14:46:04 PST 2012


I was pondering about this on twitter, at first I thought using cycrllic
variables to resolve references to object within the JSON object but
actually we just need "this" to work within object literals and be allowed
in the specification. For example this works currently :
({a:function(){
  return this.b;
},b:123}).a()

But it would be nicer to resolve "this" inside a object literal property to
be itself rather than window or undefined:
({a:this,b:123}).a.b

This would make JSON much smaller and allow circular references without
losing data.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120122/9563952a/attachment.html>


More information about the es-discuss mailing list