On Wednesday, 26 June 2013 at 15:48:42 UTC, Jonathan M Davis wrote:
It doesn't break anything. It just shows the need for pure.

Really? In the following simplified code I see mutation of an immutable variable, which should not be possible, of course. That is breaking the type system, no? What am I missing?

import std.stdio;
int* point;
struct TplPoint {
    int _point;
    this(int x) {
        _point = x;
        point = &_point;
    }
}
void main() {
    immutable TplPoint my = TplPoint(42);
    writeln(my._point); // 42
    *point = 13; // uh-oh
    writeln(my._point); // 13 !!!
}

Reply via email to