copy - create a shallow (non-recursive) copy of a value
val.copy()
The copy method creates a shallow (non-recursive) copy of a
value. This is the same as the @
operator.
Note that the copy method is used to overload the
@
operator.
A new copy of the value
None
a = [1,2,3] b = a.copy() b[1] = 20 a 1 2 3 b 1 20 3 // The copy method is used to overload the "@" operator class foo { var a; public proc create(arr) { a = arr; } public proc copy() { "Copying!\n"; return new foo(a); } } x = new foo("hello") y = @x Copying!