immutable, const, enum

Paul D. Anderson paul.d.removethis.anderson at comcast.andthis.net
Tue Apr 28 16:38:46 PDT 2009


bearophile Wrote:

> Many thanks Steven Schveighoffer for the good explanations. Now I think I have understood what's one of the purposes of const. const arguments of a function just states that you aren't going to change the data inside a function/method, more or less like in C++, but in a transitive way.
> 
<snip> 

> But it doesn't work, so maybe in and const are the same thing now. Is "in" going to be removed then? Or maybe it's better to remove const and keep just a transitive "in". And I have seen "immutable ref" too is allowed, I guess it's mostly for performance reasons. Maybe "immutable in" is just for show, this works:
> 
> So the available ones are ("in" not listed to keep a bit of my sanity):
>  immutable type
>  const type
>  out type
>  immutable ref type
>  const ref type
>  type
>  type*
>  type**
>  etc
> 

On the language/functions page:

"The in storage class is equivalent to const scope."

I hope that clears everything up for you! :-)

Paul



More information about the Digitalmars-d mailing list