On Sat, 05 Jun 2010 20:42:43 -0400, bearophile <[email protected]> wrote:

Do you know why this D2 program prints const(char)[] instead of char[] ?

import std.stdio: writeln;
void main() {
    int[char[]] data = [cast(char[])"foo" : 1];
    foreach (key, val; data)
        writeln(typeid(typeof(key)));
}

Probably because you aren't allowed to change keys for AAs. Passing the key as a char[] type would allow that.

Although I wasn't aware the compiler did that...

-Steve

Reply via email to