Immutable array initialization in shared static this
Era Scarecrow
rtcvb32 at yahoo.com
Fri Jul 13 11:09:57 PDT 2012
When you use the length property it allocates space and assigns
it to the immutable array. the array now contains data (10 0's).
You've said you won't change any data in it's declaration but the
array itself can be changed (appending or a different array).
I would think the best solution is to create a mutable local
version, and then assign the immutable global one when you are
done. If the array is particularly short (Like your example),
then appending will work fine for your values (unless you mutate
the array as part of it's calculation, then a local copy is
required).
More information about the Digitalmars-d-learn
mailing list