Object copy

David Bruant bruant.d at gmail.com
Wed Jun 11 00:58:02 PDT 2014

Hi Maxime,

Good to see you here :-)

This topic has been discussed recently on Twitter. See

I'm like Rick's answer in particular
as I believe a large share of cloning is just about data

As discussed in this Twitter thread, immutable data structures would be 
an interesting idea too. If an object is guaranteed to be deeply 
immutable, then, it can be passed around without the need for cloning. 
Clones are only necessary because the initial object is mutable in the 
first place.
Immutable data structures have been briefly discussed here recently:
(see replies too)


Le 11/06/2014 08:49, Maxime Warnier a écrit :
> Thanks for your answers.
> Object.assign seems good but provides only copy for enumerable
> properties, not a real deep clone.
> I know for jquery, that's why i precised "only for DOM" but it was
> just to show the syntax :)
> 2014-06-11 0:00 GMT+02:00 Rick Waldron <waldron.rick at gmail.com>:
>> On Tue, Jun 10, 2014 at 12:32 PM, Maxime Warnier <marmax at gmail.com> wrote:
>>> Hi All
>>> Do you know if it is planned or maybe in discussion for ES7 to have a
>>> simple clone system on objects ?
>>> There are different notations, from :
>>>   - jquery
>>> Object.clone( [withDataAndEvents ] [, deepWithDataAndEvents ] )
>> jQuery doesn't clone objects, it clones DOM elements.
>> Rick

More information about the es-discuss mailing list