Is D 0.163 D 1.0?

Sean Kelly sean at f4.ca
Tue Jul 25 06:32:16 PDT 2006


Walter Bright wrote:
> Derek wrote:
>> On Mon, 24 Jul 2006 00:33:23 +0000 (UTC), Andrei Khropov wrote:
>>
>>> And what about double meaning of 'auto'?
>>
>> In general 'auto' is a poor choice for both meanings. 'auto' is obviously
>> shorthand for automatic, but automatic what???
>> Walter, given that 'auto' as a keyword is not going to be removed from 
>> the
>> language, how can one currently declare a type-inferred variable that has
>> RAII properties?
>>
> 
> Regan Heath penned the solution I thought I'd posted a while back, but 
> maybe I hadn't:
> 
>> class A {}
>>
>> A a = new A(); //normal
>> A a = A(); //destroyed at end of scope
>>
>> and with auto..
>>
>> auto a = new A(); //normal
>> auto a = A(); //destroyed at end of scope
>>
>> Simple, elegant, obvious (IMO) 

Yup, you had :-)

Assuming this happens, is there any chance it could be a valid syntax 
for initializing concrete types as well?  Personally, I find it quite 
useful that C++ uses the same syntax for all types, be they user-defined 
or not, as it makes for simpler template code.


Sean



More information about the Digitalmars-d mailing list