David:

What kind of bugs does it avoid?
I can't think of a single bug which could happen...
(Ranges/Lengths are checked at runtime...)

Some reasons:
- Syntax uniformity: similar behaviours should look similar. This is a general rule of language design, that avoids troubles you don't even know. All array ops use [], so it's right for vector assignment to use them. - The second rule is that in a language as D we want to denote different code complexities with different code. This is the reason given in the Changelog, and it explains while length and walkLength have different names. In past you were not able to tell from a look at the syntax what's happening:

void main() {
    int[][3] x;
    int[]    y;
    int[]    z;

    x[] = z; // copies just the z pointer
    y[] = z; // copies the elements in z
}


More details:
http://d.puremagic.com/issues/show_bug.cgi?id=7444
Coming from this older:
http://d.puremagic.com/issues/show_bug.cgi?id=3971

You are welcome,
bearophile

Reply via email to