On 2014-01-17 07:18, Timon Gehr wrote:

class Foo{ int x = 2; }

class Bar{ auto foo = new Foo(); }

void main(){
     auto ibar = new immutable(Bar)();
     auto bar = new Bar();
     static assert(is(typeof(ibar.foo.x)==immutable));
     assert(ibar.foo.x==2);
     bar.foo.x=3;
     assert(ibar.foo.x==3); // uh-oh!
}

Oh, that's just bad. Yet another hole in the type system.

--
/Jacob Carlborg

Reply via email to