1Builtins.copy(3kaya) Kaya module reference Builtins.copy(3kaya)
2
3
4
6 Builtins::copy - Copy a value
7
9 any copy( any x )
10
12 x The value to copy
13
15 Create a deep copy of any value. Contrasting with assignment, which
16 creates another reference, this function traverses the entire structure
17 and creates a clone. Note that this function is not pure, as even
18 called with the same input, it returns a different copy each time.
19
20
21 a = [5,6,7];
22 myFunction(a); // pass by shallow copy
23 myFunction(copy(a)); // pass by deep copy
24
25 Copying a structure containing a foreign pointer (for example a data‐
26 base or file handle, or a piece of binary data) will copy the pointer
27 but will not copy the contents of that pointer.
28
30 Kaya standard library by Edwin Brady, Chris Morris and others
31 (kaya@kayalang.org). For further information see http://kayalang.org/
32
34 The Kaya standard library is free software; you can redistribute it
35 and/or modify it under the terms of the GNU Lesser General Public
36 License (version 2.1 or any later version) as published by the Free
37 Software Foundation.
38
39
40
41Kaya December 2010 Builtins.copy(3kaya)