Array literals MUST be immutable.

Michel Fortin michel.fortin at michelf.com
Wed Feb 17 17:21:18 PST 2010


On 2010-02-17 20:07:20 -0500, Michael Rynn <michaelrynn at optusnet.com.au> said:

> Is there anything that is really awkward in D2 working with immutable
> string type, that cannot be done without resorting to mutable character
> literals?   If not, then the principle can be applied to all "immutable
> source".

Well, array literals are not always constants. Take this for instance:

	int[] array = [x, y, z];

This array literal does not have an "immutable source" as you call it.

Should it really require a ".dup" to get a mutable array? How efficient 
would it be?

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list