Eigenpoll : D wish list : copy operator 

Some way to uniformly describe shallow copying of object state.

Currently "a = b" behaves quite differently in the case where a and b are structs, and where a and b are object references.

Something like "a := b" or "a <- b" or "a @= b" or "*a=b". For structs this would behave the same as "a=b", for arrays it would behave as "a[]=b" but for objects it would translate to something like a.opCopy(b). A default opCopy that does a simple shallow memory copy could be implemented by the compiler automatically if none is provided by the user.

Report this item for cleanup