auto storage class - infer or RAII?

Bill Baxter dnewsgroup at billbaxter.com
Mon Nov 13 00:22:56 PST 2006


Walter Bright wrote:
> Bill Baxter wrote:
>> Walter Bright wrote:
>>> I think the auto/scope is probably the best idea.
>>
>> That will have some affect on this:
>>
>>     int (a) = 3;
>>     writefln(a);
>>     int (exit) = 9;
>>     writefln(exit);
>>
>> which all is currently ok.  But with scope as a storage class, this:
>>
>>     scope (exit) ;
>>
>> would become ambiguious.  Is it an empty scope(exit){} or is it a 
>> scoped variable called exit that wasn't initialized?
> 
> I don't think it'll be ambiguous. scope isn't a type or a function, 
> there is no:
>     static (a) = 3;
> allowed anyway. 

Ah, I hadn't tried that.  I assumed it would be OK, too.

 > The rule would be:
 >     scope (
 > means a scope statement, otherwise scope would be a storage class.

Yeh, that works given the above.  Whew!


--bb



More information about the Digitalmars-d mailing list