Should conversion of mutable return value to immutable allowed?
Jesse Phillips
jessekphillips+D at gmail.com
Thu Feb 24 11:20:12 PST 2011
Ali Ãehreli Wrote:
> I have another question: Does calling .idup copy any data below?
>
> string foo()
> {
> char[] s;
> return s.idup; // Is the content copied?
> }
>
> Ali
>
Yes, dup stands for duplicate and is a property of arrays.
There was discussion for allowing immutable objects to be created and return from pure functions.
More information about the Digitalmars-d
mailing list