On Sun, Jan 22, 2012 at 4:05 PM, Jake Verbaten <[email protected]> wrote:

> On Sun, Jan 22, 2012 at 8:29 PM, Rick Waldron <[email protected]>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).
>

This is already too much "unfortunate" restriction.

What about calculated "get" properties:

> var o = {
...   get foo() {
...     return "foo";
...   }
... },
... clone = JSON.parse(JSON.stringify(o));

> clone
{ foo: 'foo' }




> 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.
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to