textuml
textuml copied to clipboard
Specify a clone() operation in Basic/Object/Value
Specify a clone() operation in Basic/Object/Value, which performs a shallow clone (or deep clone)?
A challenge here is how to declare the return type of this operation. The language currently does not allow for covariant return types.
Looks like something better done via a function:
function clone<T>(toClone : T) : T;
or a special clone operator, such as have with new, meaning an object creation where properties are initialized with the source object.