if(;){} opinion
Derek Parnell
derek at psych.ward
Tue Feb 28 03:52:52 PST 2006
On Tue, 28 Feb 2006 17:44:28 +1100, Walter Bright
<newshound at digitalmars.com> wrote:
>
> "Charles" <noone at nowhere.com> wrote in message
> news:du002j$2pcm$1 at digitaldaemon.com...
>> I think its short for 'auto' deduction ?
>>
>> 'var' gets my vote
>
> 'auto' goes way back to C and means "allocate on the stack". This also
> implicitly means "destruct at end of scope." In order for type inference
> to
> work, there has to be a keyword in front of the declaration to let the
> parser know it's a declaration rather than an assignment. Thus, 'auto'
> now
> means "allocate on the stack" and if the type is missing it also means
> "infer the type." Types can be inferred with other storage classes:
>
> static x = 3; // x is int
>
> This follows the 'auto' proposal for C++ as far as I know.
>
> 'var' would be a digression into pascalishness (ugh <g>).
Language Bigot! <G>
Seriously though ... who cares if its a C thingy! This is NOT C. But you
already know that. Just because C does 'X' is it good enough to justify
keeping 'X'? You've already changed lots of other things to achieve a
better, consistent, language - so why stop at this wart.
'auto', as a word, is too ambiguous to because it is an adjective that can
apply to many things. Ok, so C applys it to automatic stack allocation and
so does D, but D also applies it to automatic type-casting too. Why do you
want your language to be ridiculed for this wart when it is so easy to
change it. If you are too frightened of it being a Pascal-looking language
(and 'var' will not do that, BTW), then pick some other more meaningful
word.
--
Derek Parnell
Melbourne, Australia
More information about the Digitalmars-d
mailing list