Timon Gehr:
> What about
>
> void generate(this Foo[] self, int len) this{ // maybe there is a better
> syntax
> // init self
> }
>
> ?
>
> This would just have the same restrictions as a class/struct constructor
> that initializes immutable fields.
At a first look I like this idea. Is this idea going to work well?
Note that currently you can't initialize a const array in a constructor (I
think this is bug):
struct Foo {
const int i;
const int[3] array;
this(int x) {
this.i = x;
this.array[0] = x; // Error: this.array[0] isn't mutable
}
}
void main() {}
Bye,
bearophile