auto storage class - infer or RAII?

Bill Baxter wbaxter at gmail.com
Sat Nov 11 21:50:06 PST 2006


Tydr Schnubbis wrote:
> Chris Nicholson-Sauls wrote:
> 
>>> Considering that scope already exists as a keyword, I find this an 
>>> excellent
>>> suggestion that is also very much clearer in meaning (I find auto to 
>>> miss
>>> the target for both cases really :P ).
>>>
>>
>> I've already said it before, but it bears repeating yet again.  I also 
>> prefer 'scope' for this.  Although 'infer' wouldn't be bad -- but 
>> please, please, please, not 'var'!  It smells too much like a 
>> scripting language construct, and besides, my Bovis code is 
>> overflowing with actual variables named var.  (Probably because of the 
>> BVar struct that it passes most values around as.  Go figure.)
>>
> 
> 'scope' and 'infer' sound good to me, very to-the-point and unambiguous. 
>  No need to make people wonder if 'auto' works like in C or not, etc. 
> Just drop it.

"scope" seems a pretty popular suggestion.
I find it not so bad myself, but I would prefer "scoped" because it's 
less ambiguious.  "scope" makes sense if you think of scope as a verb 
(scope this variable), but just seeing it outside of a sentence it looks 
like a noun (this variable is a scope -- huh?), simply because 'scope' 
isn't used as a verb very often in English.

'scoped' is clearly an adjective, as in 'this variable is scoped'.  And 
being an adjective puts it in good company with most of the other 
storage classes which are also adjectives: (abstract, auto(matic), 
const(ant), deprecated, extern(al), final, static, synchronized).  The 
only non-adjective storage class is 'override'.  I have no idea why it's 
not "overridden".  It should be.  At least override reads clearly, 
whether you take it to be a noun (this is an override) or a verb 
(override the method).  "Scope" does not have this property.  "This is a 
scope" does not make sense.

--bb



More information about the Digitalmars-d mailing list