auto storage class - infer or RAII?

Chris Nicholson-Sauls ibisbasenji at gmail.com
Sun Nov 12 15:10:17 PST 2006


Ary Manzana wrote:
> Chris Miller escribió:
> 
>> On Sun, 12 Nov 2006 08:28:51 -0500, Andrey Khropov 
>> <andkhropov_nosp at m_mtu-net.ru> wrote:
>>
>>> Walter Bright wrote:
>>>
>>>> And that's why I've avoided using "var".
>>>
>>>
>>> Well, 'var' is used in C# 3.0 for this purpose (which is obviously a 
>>> C-family
>>> language and a popular one)
>>>  And it's also used in JavaScript and  Scala
>>> (which have mostly C-family look and feel)
>>> So I think this isn't a serious concern.
>>>
>>> And as you can see from this and other threads most people here are 
>>> happy with
>>> it except those who seldom use it for variable naming.
>>>
>>
>> I don't like "var" because it reminds me of a cheap script like 
>> JavaScript, but I'm not that against it.
> 
> 
> So change "var" into "infer", as others sugested, if the only concern is 
> the name of the keyword. :-)
> 
> infer x = 2;
> infer y = new Foo();
> 
> I believe it's the most clear syntax:
> - "auto" -> automatic what?
> - "var" -> I know it's a variable, so...?
> - "infer" -> Ah! It's infering the type...

Wholeheartedly agreed.  I really do hope 'var' doesn't make it in...  I actually use it 
/quite a lot/ in my code.  Last night, to see what the impact would be, I ran a search 
through some of my code... and had hundreds of hits for just "var", let alone all the 
other things with "-var-" in their names because I've assumed it was a safe name.

-- Chris Nicholson-Sauls



More information about the Digitalmars-d mailing list