Tidy auto [Was: Re: @disable]

Leandro Lucarella llucax at gmail.com
Tue Jan 19 09:48:27 PST 2010


Jesse Phillips, el 19 de enero a las 15:21 me escribiste:
> 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

I only have LDC (based on DMD 1.051) and GDC (based on DMD 1.024) here,
LDC fails with this message:
/tmp/x.d(4): Error: variable x.main.x both auto and explicit type given
And GDC works, so I think it might be a regression. I should test with the
latest DMD...

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
Que barbaridad, este país se va cada ves más pa' tras, más pa' tras...
	-- Sidharta Kiwi



More information about the Digitalmars-d mailing list