Should .idup simply do nothing for arrays that are already immutable?
dsimcha
dsimcha at yahoo.com
Fri Jan 8 13:07:16 PST 2010
import std.stdio;
void main() {
immutable foo = "FOO";
immutable bar = foo.idup;
writeln(foo.ptr, '\t', bar.ptr);
}
Output:
42C090 97AE40
Should we define .idup on an already-immutable array to simply do nothing? It
seems that there is never any good reason to copy an immutable array, and it
would avoid the need to either needlessly copy an array or explicitly check
for immutability in metaprogramming situations.
More information about the Digitalmars-d
mailing list