Immutable static arrays

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Mar 16 20:53:06 PDT 2012


Is this a bug?

	import std.stdio;
	void main() {
		immutable(int)[4] a;
		immutable(int[4]) b;
		writeln(typeid(a));
		writeln(typeid(b));
	}

Output:

	immutable(int[4])
	immutable(int[4])

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???).


T

-- 
It is widely believed that reinventing the wheel is a waste of time; but
I disagree: without wheel reinventers, we would be still be stuck with
wooden horse-cart wheels.


More information about the Digitalmars-d mailing list