Re: How would we copy... Anything?

2015-02-23 Thread Andreas Rossberg
On 23 February 2015 at 10:37, David Bruant bruan...@gmail.com wrote: Le 23/02/2015 10:10, Michał Wadas a écrit : Cloning objects is long requested feature. clone object javascript yields 1 480 000 results in Google. I'd like to share this as an answer

Re: How would we copy... Anything?

2015-02-23 Thread Anne van Kesteren
On Mon, Feb 23, 2015 at 10:10 AM, Michał Wadas michalwa...@gmail.com wrote: My proposition is to create a new well known Symbol - Symbol.clone and corresponding method on Object - Object.clone. Anything that does not deal with https://github.com/dslomov-chromium/ecmascript-structured-clone

How would we copy... Anything?

2015-02-23 Thread Michał Wadas
Cloning objects is long requested feature. clone object javascript yields 1 480 000 results in Google. My proposition is to create a new well known Symbol - Symbol.clone and corresponding method on Object - Object.clone. Default behavior for an object is to throw on clone try.

Re: How would we copy... Anything?

2015-02-23 Thread David Bruant
Hi, Le 23/02/2015 10:10, Michał Wadas a écrit : Cloning objects is long requested feature. clone object javascript yields 1 480 000 results in Google. I'd like to share this as an answer http://facebook.github.io/immutable-js/#the-case-for-immutability If an object is immutable, it can be

Re: How would we copy... Anything?

2015-02-23 Thread Michał Wadas
I'm aware about structured clone, but there is a basic difference - structured clone is a way to copy object to other Realm, Symbol.clone would be a more powerful (supporting constructors, classes and functions) way to clone objects. On Feb 23, 2015 10:29 AM, Anne van Kesteren ann...@annevk.nl