Newbie comments about D

Chad J gamerChad at _spamIsBad_gmail.com
Thu Aug 17 15:00:20 PDT 2006


Reiner Pope wrote:
> Kristian wrote:
> 
>>
>> --- 4 ---
>>
>> By the way, the 'auto' attribute is used with local variables, so 
>> would a word 'local' be a more logical choice?
>>
>> void f() {
>>     local C c = new C;
>>     ...
>> }
> 
> A huge change of code would be required for that.
> 

Argh.  Can't we rig the compiler to automatically change code over to 
the new keyword or something?  Or at least give good error messages when 
the obsolete meaning of auto is used, to help coders with the search and 
replace?

Using a new keyword would make something like
auto C c;
into error causing code at the very least, even if the error message 
isn't entirely descriptive (we can at least get line number right?).

Also I'd suggest using 'scope' instead of 'local', as suggested before. 
Scope is already a reserved keyword (Kristian look it up in the spec 
under "Statements", it's quite handy).  It also just so happens that the 
meaning of scope in this context and it's current context is very 
similar.  So no need to rename identifiers that already use the word 
(because there are none) AND it makes sense, yay.

Anyhow, that's my argument for doing it anyways.  I'd like to see this 
done.  It also looks like a good pre-1.0 change since it breaks 
backwards compatibility.

Unless there's something I'm missing, it actually doesn't look too 
difficult to update code if this were done.  I'd even be willing to 
update peoples' code if it makes this happen.



More information about the Digitalmars-d mailing list