DMD 2.000 alpha release

Walter Bright newshound1 at digitalmars.com
Wed Jun 20 01:19:52 PDT 2007


Reiner Pope wrote:
> This looks great!
> 
> But as it is, I can't find a difference between invariant(char)[] and 
> invariant(char[]).

There isn't one for declarations, as the const/invariant doesn't apply 
to the declaration's value itself - only what the declaration refers to.


> And thirdly, I'm not sure about invariant and const as storage classes. 
> They seem to be identical, saying "a compile-time constant", but also 
> applying transitively to their types. But if I have a compile-time 
> constant, how can it refer to data that can change?

There is no difference between:

	const int x = 3;

and:

	invariant int x = 3;

The difference between const and invariant shows up with references to 
other data.



More information about the Digitalmars-d-announce mailing list