A few inconsistentcies left

BCS BCS at pathlink.com
Thu May 25 11:32:19 PDT 2006


Hasan Aljudy wrote:
> Charlie wrote:
> 
>> 2)  auto auto foo = new Class;  The current double meaning of auto 
>> won't  allow for both a RAII and type-deduced variable declaration.  I 
>> think every other language use's 'var' or similar ( var gets my vote, 
>> used in php, javascript, C#-3.0) .  The current error is 'redundant 
>> storage class 'auto''.
> 
> 
> auto can mean many many things!!
> 
> I prefer to get rid of auto all together.
> for automatic type inference ==> use 'var'
> for RAII, hmm, maybe use something like 'raii'
> 
> # raii var foo = new Foo;
> 
> 
IIRC that would be:

#raii foo = new Foo;

the "auto" dosn't indicate auto typing, it's just a storage classe to 
indecate a decleration. "auto" is used because most of the time it has 
no effect.

These all works:

void main()
{
         auto f2 = cast(int)'\n';
         const f3 = cast(int)'\n';
         extern f5 = cast(int)'\n';
         static f8 = cast(int)'\n';
         synchronized f9 = cast(int)'\n';
}

see http://www.digitalmars.com/d/declaration.html#AutoDeclaration



More information about the Digitalmars-d mailing list