Tidy auto [Was: Re: @disable]

Leandro Lucarella llucax at gmail.com
Tue Jan 19 06:53:56 PST 2010


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.

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
I've always been mad, I know I've been mad, like the most of us...
very hard to explain why you're mad, even if you're not mad...



More information about the Digitalmars-d mailing list