"H. S. Teoh" <[email protected]> wrote in message news:[email protected]... > On Sat, Mar 17, 2012 at 02:59:55PM +1100, Daniel Murphy wrote: > [...] >> > So there's no tail-const type for static arrays? >> > >> > More to the point, how should AA's with immutable static array keys >> > be implemented? The current implementation doesn't work at all >> > because the input static array can't be assigned to the Slot (the >> > static array field in Slot is completely immutable, even from the >> > Slot ctor???). > [...] >> This is correct. It's the same as for primitive types. Because they >> implicitly convert to immutable, AAs should store a mutable copy. >> T[N] should be handled almost the same as T. > [...] > > So string[immutable int[4]] should store int[4] as key? > > I guess I just found it strange that assigning to a string > (==immutable(char)[]) field is OK, but assigning to immutable(char[4]) > is not. >
The difference is dynamic arrays contain an indirection, static arrays don't. Treat them the same as you do primitive types and they should work. (apart from compiler bugs)
