if(;){} opinion
Walter Bright
newshound at digitalmars.com
Mon Feb 27 22:44:28 PST 2006
"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>).
More information about the Digitalmars-d
mailing list