Array literals REALLY should be immutable

grauzone none at example.net
Thu Nov 12 08:56:46 PST 2009


Don wrote:
> I think this is quite horrible. [1, 2, 3] looks like an array literal, 
> but it isn't -- it's an array constructor. It doesn't look like a 
> function call. It shouldn't be.

Can we make

int[3] a = [1,2,x];

Just Work (tm)?

Because right now (D1), it allocates an array literal, and then copies 
it into the static array. Incredibly stupid.



More information about the Digitalmars-d mailing list