if(;){} opinion

Jari-Matti Mäkelä jmjmak at utu.fi.invalid
Tue Feb 28 10:48:51 PST 2006


Bruno Medeiros wrote:
> Walter Bright 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.
>>
> Now this is something I've been meaning to comment on but haven't yet.
> This is damn AWFUL. No autotype declaration should work without the the
> autotype keyword! And I don't care if if deviates from the C++ or not,
> it's just plain bad. *angry face*
> 
>> 'var' would be a digression into pascalishness (ugh <g>).
> It wouldn't be, because they do different things. And even if it were,
> what would be the problem?? What matters in a feature/design is how good
> it is, not if it is similar to other languages or not.

That's true. And many other "good" features like with-statements in D
originate from Pascal. IMO the worst things in Pascal are variable
declarations and too long keywords, otherwise it's damn illustrative and
rational language.

-- 
Jari-Matti



More information about the Digitalmars-d mailing list