A few inconsistentcies left

Sean Kelly sean at f4.ca
Thu May 25 11:43:59 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 what it's worth, the next iteration of C++ will use 'auto' to denote 
automatic type inference.

> for RAII, hmm, maybe use something like 'raii'
> 
> # raii var foo = new Foo;

I still think the signifier for this is probably more appropriately 
associated with the instance than with the reference, since 'raii' isn't 
really a type qualifier.  I'd prefer:

auto foo = local Foo;

where 'auto' denotes automatic type inference and 'local' replaces 'new' 
to denote stack-based construction.  As far as 'local' is concerned, 
it's too bad 'new' is so generic.  Perhaps it should be 'new local' for 
scoped allocations?


Sean



More information about the Digitalmars-d mailing list