Deep cloning objects defined by JSON.
raynos2 at gmail.com
Sun Jan 22 13:05:20 PST 2012
On Sun, Jan 22, 2012 at 8:29 PM, Rick Waldron <waldron.rick at gmail.com>wrote:
> Potential issues
>> - subset of JSON is too restricted to be useful
> This alone seems like a deal-breaker/non-starter. How would you copy
> methods? Forgetting about cyclic reference exceptions for a moment:
The idea here is that methods do not belong in data structures (clone
should be to efficiently clone data). a possible solution would be allow
you to set the [[Prototype]] of the returned clone through the API somehow
and then store methods on prototypes.
It does gain the benefit of not having to document the edge-case behaviour
for cloning methods. It would presumably also be an API that can
efficiently clone the new binary data types. The main purpose is efficient
in memory copies of data and not generic cloning of things.
If we add a clone, we probably want to add support for cloning binary data
types to the list as well.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss