Explicit keyword for "plain old local variable" storage class?

Roald Ribe rr.nospam at nospam.teikom.no
Sat May 27 15:22:04 PDT 2006


kris wrote:
> Jarrett Billingsley wrote:
>> The problem is just when it comes to auto classes.  Either we come up 
>> with a new keyword for the behavior of auto classes, i.e. "raii":
>>
>> raii Foo f = new Foo();
>>
>> // Type inference
>> raii g = new Goo();
>>
>> Or, something I was thinking - just reuse scope, as it's not used by 
>> itself anywhere.
>>
>> scope Foo f = new Foo();
>>
>> Though I'll admit, it's not as self-explanatory as "raii Foo". 
> 
> Are you kidding? RAII is about as self explanatory as a goat in a 
> tumble-dryer. On the face of it, the use of 'scope' here seems like a 
> great idea :)

I agree with you on raii. But I think local would be the optimal
keyword. local in scope, local on stack. local would be up to the
compiler to implement, depending on the environment, like register
in C. (meaning could even be tuned by a compiler switch).
scope is a good second IMO.

Roald



More information about the Digitalmars-d mailing list