const question/suggestion
Reiner Pope
some at address.com
Mon Jun 18 23:22:08 PDT 2007
James Dennett wrote:
> Walter Bright wrote:
>> Myron Alexander wrote:
>>> const var = new SomeObject ();
>> The above line will fail because const declarations can only be
>> initialized with something that can be evaluated at compile time. The
>> example should be:
>>
>> const(SomeObject) var = new SomeObject();
>
> Is there any way to use type deduction to avoid having
> to repeat the SomeObject part of this?
>
> -- James
It seems like something like that should be plausible. How about:
const() var = new SomeObject(); // --> const(SomeObject) var;
const var2 = new SomeObject(); // --> const SomeObject var;
-- Reiner
More information about the Digitalmars-d-announce
mailing list