I have searched and can not understand something about passing AAs to a function.
I have reduced the gist of the question to a tiny program below.
If I put "ref"  in the function stmt it works, i.e.:
        ref int[int] aa
My confusion is that AAs are supposed to be passed as refs anyway, so I do
not understand why I should have to use ref to make it work.

Related, it also works if I UN-comment the line    d[9] = 9;

Thanks for any helpful comments you can make.
--rbutler

import std.stdio;

void test(int[int] aa, int x) {
    aa[x] = x;
    aa[8] = 8;
}

void main() {
    int[int] d;
    writeln(d.length);
    // d[9] = 9;
    test(d, 0);
    writeln(d);
}

Reply via email to