2013/5/15 Don Clugston <[email protected]>

> But I argue it should simply be an error, rather than replacing it with a
> misfeature.
>

I cannot understand why you argue the new behavior is a 'mesfeature'.
Const/immutable variable type and specifying variable initializer
should not interfere with each other.
Under the old behavior, following code never work.

struct S {
    immutable int x = 1;
    this(int x) { this.x = x; }
}
void main() {
    S s1;    // default construction
    assert(s1.x == 1);
    S s2 = S(2);    //
    assert(s2.x == 2);
}

I think this is necessary to make non-mutable object field more usable.

Kenji Hara
_______________________________________________
dmd-beta mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/dmd-beta

Reply via email to