Asking a const-related fix [Was: Re: DMD workforce contribution]
bearophile
bearophileHUGS at lycos.com
Mon Nov 7 02:49:52 PST 2011
Given how much often I find this problem in D coding, is someone willing and able to write a patch to allow code like this (it's in Bugzilla, with normal priority)?
const struct Foo {
const int[5] a;
const int[] b;
const int[int] aa;
this(in int n) pure {
this.a[] = n; // line 6
this.b = new int[5];
this.b[0] = n; // line 8
this.aa[1] = 2; // line 9
}
}
void main() {}
The latest DMD gives:
test.d(6): Error: slice this.a[] is not mutable
test.d(8): Error: this.b[0] isn't mutable
test.d(9): Error: this.aa[1] isn't mutable
Bye,
bearophile
More information about the Digitalmars-d
mailing list