Array literals

bearophile bearophileHUGS at lycos.com
Wed Oct 15 18:03:27 PDT 2008


Steven Schveighoffer:
> I think this can be solved even simpler.  Make string literal type be 
> invariant(char)[] instead of static array.  It does not need to be on the 
> heap.  That would solve lots of IFTI problems too.

With your idea this syntax:
auto a = ["Hello", "what"];
Gives a fixed-sized array of invariant(char)[]. I think that's asymmetric. My suggestion works with all arrays, so the array 'a' too becomes/is dynamic, keeping the simmetry.

Bye,
bearophile



More information about the Digitalmars-d mailing list