Auto constructor [Was: Archetype language]
KennyTM~
kennytm at gmail.com
Mon Mar 21 08:51:33 PDT 2011
On Mar 21, 11 18:26, Daniel Gibson wrote:
> Am 21.03.2011 11:09, schrieb KennyTM~:
>> On Mar 21, 11 16:17, Don wrote:
>>>
>>> I agree. But unfortunately, the idea is a relatively complicated feature
>>> with a lot of special cases. For example, this(this.bla, this.bla){}
>>
>> 'int f(int x, int x) {}' is a syntax error. So should 'this(this.x, this.x){}'.
>>
>
> and probably this(this.x, x){}
Yes. This is handled by the AST transform (lowering) too.
this(this.x, int x) {
statements;
}
becomes
this(typeof(this.x) x, int x) {
this.x = x;
statements;
}
which will complain
Error: constructor x.Foo.this parameter this.x is already defined
as expected.
More information about the Digitalmars-d
mailing list