[dmd-beta] dmd 2.064 beta take 2

Kenji Hara k.hara.pg at gmail.com
Wed May 15 07:35:38 PDT 2013


2013/5/15 Don Clugston <dclugston at gmail.com>

> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/dmd-beta/attachments/20130515/e5daaef8/attachment-0001.html>


More information about the dmd-beta mailing list