On 01/17/2014 03:11 AM, Adam D. Ruppe wrote:
On Friday, 17 January 2014 at 02:04:27 UTC, Andrei Alexandrescu wrote:Yah, that would be expected.Yeah, but I think people would find it weird. This kind of thing is actually possible today:
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! }