import std.stdio;
void main() {
    int[] a;
    int[int] aa;
    a ~= a.length;
    aa[10] = aa.length;
    writeln(a, " ", aa);
    a ~= a.length;
    aa[20] = aa.length;
    writeln(a, " ", aa);
}


It prints:

[0] [10:1]
[0, 1] [20:2, 10:1]

So the associative array is updated before taking its length. I suggest to try to fix this AA behavour before too much D2 code relies on this. I'd like to avoid this to become a permanent wart of D2.

My bug report is from February 2010, it's in the most important 20 bug reports of mine. In my opinion it's wrong to add new features to D before similar bugs are fixed:

http://d.puremagic.com/issues/show_bug.cgi?id=3825

Thank you,
bye,
bearophile

Reply via email to