Proposal: Type inference for variable definition/initialization using the 'auto' keyword.
Rémi Forax
forax at univ-mlv.fr
Fri May 15 16:15:32 PDT 2009
Mark Thornton a écrit :
>> You're right. These two classes are not statistically significant, but:
>> - number of lines where "auto" can be used is always >= the number of
>> lines where "diamond" can be used
>>
>>
>>
> Only if you don't follow the common policy of using an interface type on
> the left hand side. With that policy 'auto' is unusable.
>
The common policy is stupid because you should only use interfaces when
needed.
When you write a code you talk to the guys that will read it.
So If you put an interface, you say something like, here the code is not
obvious
because more that one implementations may be used.
Only code your needs, never more.
>> OK. I didn't know that Java was designed to explicitly declare the
>> type of variables on the left hand side,
>> but even if it was, it's worth changing.
>>
>>
> It allows it and it is a common policy that many have deliberately
> chosen to use and recommend.
>
> Mark Thornton
>
>
Rémi
More information about the coin-dev
mailing list