Is D 0.163 D 1.0?

Chris Nicholson-Sauls ibisbasenji at gmail.com
Tue Jul 25 22:27:13 PDT 2006


kris wrote:
> Chris Nicholson-Sauls wrote:
> 
>> Don Clugston wrote:
>>
>>> Nooooooooo!!!!
>>> Am I the only person who has hundreds of local variables called 'var'?
>>> (mostly variants in Win32 code).
>>>
>>> A quick google search for 'var cpp' showed a million hits, a fair 
>>> chunk of them are local variables in C++ code. It's a very popular 
>>> variable name.
>>
>>
>>
>> Actually I do feel your pain, but I still vote for it.  Waaay back in 
>> the day I used to do a lot of LambdaMOO server hacking, and therein I 
>> discovered my first Var struct.  (That'd be about 1996 I think it 
>> was.)  Now, ten years later, I am working on BovisMOO... and I'm still 
>> using a Var struct (albeit a much cleaner one), and plenty of 
>> temporary Var's named, yes, 'var.'
>>
>> But I can always just rename them to 'tmp', or something else.  
>> (Actually a lot of them would probably get renamed 'result' since 
>> that's what they generally are.)
>>
>> -- Chris Nicholson-Sauls
> 
> 
> I suspect the focus should be directed elsewhere, Chris?
> 
> There's nothing wrong with using "auto" for implicit-type -- it's the 
> confusion with raii that's the issue, yes?
> 
> I suspect the ratio of raii usage to implicit-type usage would be 
> overwhelmingly in favour of the latter. Thus, it would seem to make 
> sense to leave implicit-type "auto" just as it is, and change raii to 
> use something else instead; such as "scope" ?
> 
> void main()
> {
>   auto i = 10;
>   auto foo = new Foo;
>   auto scope bar = new Bar;
>   auto scope wumpus = new Wumpus;
> }
> 
> class Foo {}
> 
> class Bar {}
> 
> scope class Wumpus {}
> 

Actually that does make some sense, and I do like the meaningful re-use of an existing 
keyword over inventing a new one.  (Honestly I hadn't even considered 'scope' for this, 
even though it does make obvious sense!)  Although, I find myself almost wanting to make 
it 'scoped' for this (note the -d on the end), as that's what it is really meaning, but A) 
then it becomes a new keyword anyway, and B) it begs for typos.

I think you may've converted me.

-- Chris Nicholson-Sauls



More information about the Digitalmars-d mailing list