On Sat, 07 Mar 2009 23:40:52 -0800, Walter Bright wrote: > I'm still not understanding you, because this is a contrived example > that I cannot see the point of nor can I see where it would be > legitimately used.
I can see Burton's concern, and I'm very surprised that the compiler allows this to happen. Here is a slightly more explicit version of Burton's code. import std.stdio; void main() { int [] a = new int [1]; a [0] = 1; invariant (int) [] b = cast (invariant (int) []) a; writef ("a=%s b=%s\n", a [0], b[0]); a [0] += b [0]; writef ("a=%s b=%s\n", a [0], b[0]); a [0] += b [0]; writef ("a=%s b=%s\n", a [0], b[0]); } The problem is that we have declared 'b' as invariant, but the program is allowed to change it. That is the issue. -- Derek Parnell Melbourne, Australia skype: derek.j.parnell