Simon, our infiltration specialist, was able to install a hidden camera in the JavaScript committee's conference room. Here he is watching the committe who obviously is up to something scary.
Meouzer
Full code is at deepCopy.js, which depends on valueCopy.js, which depends on typing.js. The test file is Test-Class-Copy.js, which uses deepCopySystem to deep copy a user class instance. Search for this.deepCopy in the test file to see how it goes. Open your browser's console window to see that all current tests have been passed. If you are using IE11, then you must comment out all code attempting to change constants because such is a fatal error at compile time. To see how this.deepCopy() works see this.deepCopyExpanded() in the test file, or read below.
The term user is used as an abbreviation for programmer, not a catnip fanatic, though most of the members of the consortium are in fact catnip lovers to the extreme.
We may speak colloquially and say that a user class can be deep copied. What is meant is that class instances of the user class can be deep copied with a deepCopy() method.
Given a particular user defined class there's a good chance you can deep copy the class by using deepSystemCopy in a deepCopy() method.
The main requirement that makes a user class deep copiable is that no class methods are defined in a nested function of the constructor. Another rule is that if there are any references to class instances of another user class, then that other class must have its own deepCopy() method to perform deep copies (currently such references are not supported).
Look at function foo(). Line 6 implies that the deep copy depends upon the evaluator While lines 7-10 say that the evaluator depends upon the deep copy. You might think this is cause for some concern. However, some thinking and a careful reading of the first article on function copying will bring up an important fact about evaluators that makes it clear why everything is A-OK.