On 2009-03-07 18:19:50 -0500, Andrei Alexandrescu <[email protected]> said:

Later on I decided to save the filename for error message reporting and the such. Now I had two choices:

(1) Leave the signature unchanged and issue an idup:

this.filename = to!string(filename); // issues an idup

(2) Change the signature to

this(string filename);

Third choice: have two contructors.

        this(in char[] filename) { this(filename.idup); }
        this(string filename) { ... }

It's pretty easy to add a new version of a construcor or function when you change things and need to keep backward compatibility. The question is: should you?

--
Michel Fortin
[email protected]
http://michelf.com/

Reply via email to