Tidy auto [Was: Re: @disable]

Jesse Phillips jessekphillips+D at gmail.com
Tue Jan 19 07:21:01 PST 2010


Leandro Lucarella wrote:

> Sean Kelly, el 18 de enero a las 16:10 me escribiste:
>> bearophile Wrote:
>> 
>> > Walter Bright:
>> > > Andrei introduced me to that style, and I'm starting to use it more and 
>> > > more. I like it for the reasons you state.
>> > 
>> > I'm not using it because I'm not using D2 much yet, but I have read that a good number of people are adopting that style in other languages as Scala, so it can be a good way to program (I can appreciate it myself). If this is true then a syntax like:
>> > auto immutable x = y * 2;
>> > 
>> > can be seen as too much long and boring to write all the time, so the "immutable" keyword may need to be changed again :-)
>> 
>> Fortunately, the "auto" keyword can be left out.  "auto" is actually
>> a storage class, it doesn't directly mean "infer the type."
>
> I was under that impression too, but that's not what my test show. You can
> write auto int x = 5;, it fails to compile with an error saying that
> x have both explicit type and auto. I find this very odd, I think auto
> should be a regular storage class.
>

auto int foo = 5; 

Works fine for me, dmd 2.037



More information about the Digitalmars-d mailing list