back down on Earth [was: Re: Constructors...]

2011-01-21 Thread spir
On 01/21/2011 04:02 AM, Andrei Alexandrescu wrote: That being said, it's not difficult to define a generic function that copies fields over from one class object to another. Here's a start: import std.stdio; void copyMembers(A)(A src, A tgt) if (is(A == class)) { foreach (e; __traits(allMe

Re: back down on Earth [was: Re: Constructors...]

2011-01-21 Thread bearophile
spir: > How many programmers in the world consider this kind of code "not > difficult"? (True complex code is when you have to maintain or improve ocean-wide programs :-) ) That kind of code is library-level one, so it's more difficult than normal user code. Bye, bearophile

Re: back down on Earth [was: Re: Constructors...]

2011-01-22 Thread Pelle
On 01/21/2011 02:02 PM, spir wrote: On 01/21/2011 04:02 AM, Andrei Alexandrescu wrote: That being said, it's not difficult to define a generic function that copies fields over from one class object to another. Here's a start: import std.stdio; void copyMembers(A)(A src, A tgt) if (is(A == clas