Why is immutable not possible as a result of a reduce expression?

Jonathan M Davis jmdavisProg at gmx.com
Sat Jan 5 17:46:58 PST 2013


On Saturday, January 05, 2013 17:15:51 Ali Çehreli wrote:
> On 01/05/2013 04:59 PM, Jonathan M Davis wrote:
>  > D's auto _is_ automatic type deduction like in C++11.
> 
> It must have changed in the last couple of years. I see that the
> documentation is now different:
> 
>    http://dlang.org/attribute.html#auto
> 
> It now says "The auto attribute is used when there are no other
> attributes and type inference is desired."
> 
> It used to be not the case. The historical evidence is still there in
> compiler error messages:
> 
>      auto auto a = 1;
> 
> Error: redundant storage class 'auto'
> 
> ;)

In D, the term storage class is used for pretty much any attribute on a 
variable which is not a type constructor and therefore affects the actual type 
(i.e. const and immutable). So, in that sense, auto _is_ a storage class, but 
the term is pretty meaningless. C and C++ have a stricter definition of the 
term storage class.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list