auto, var, raii,scope, banana
Don Clugston
dac at nospam.com.au
Tue Jul 25 23:36:43 PDT 2006
Nils Hensel wrote:
> kris schrieb:
>> Don has a good point: changing to "var" would cause conflict with
>> existing variable-names.
>
> I'm sorry but I don't believe there are many programmers out there
> actually using something as undescriptive as "var" as a regular
> identifier.
Maybe my first impression of the google search yourself -- the data is
there.
I also strongly believe that no one should. It's the
> implication of a maintenance nightmare.
> I don't intend to insult Don in any way but it's a horrible practice
> IMNSHO that should not be preserved.
I don't understand. I can't see the difference between 'var' and 'x'.
Do you also dislike use of 'i' as a counter variable in a for loop?
(And if not, what is the difference?)
> So let's not focus on some odd minority but rather on the wide use of
> "var" in the context of type inference and dynamic typing.
'var' is inappropriate in a statically typed language. Remember that
'static's are variables too. Note that 'auto' was one of the original C
keywords, and was chosen without any constraint (no legacy code
whatsoever, they could have chosen any name, including 'var'). Every
variable was classed into either:
static
auto
register
> Also I don't think that it's a good habit to be looking at how C++ does
> something unless one is looking for a bad example. My main reason for
> interest in D is because personally I'm fed up with C++ and consider it
> an abomination and a major PITA.
Agreed, but the 'auto' thing ultimately comes from C, not C++.
More information about the Digitalmars-d
mailing list