http://d.puremagic.com/issues/show_bug.cgi?id=4419
--- Comment #11 from Andrej Mitrovic <[email protected]> 2013-09-13 14:01:21 PDT --- (In reply to comment #10) > (In reply to comment #9) > > > I can't reproduce this, can you paste what 'chan' is, or just paste the full > > example? E.g.: > > > > Could you try this? > class B { bool v;} > > class C > { > shared B ready = new shared B; > static shared B statReady = new shared B; > > } > > void main() > { > auto a = new C; > auto b = new C; > a.ready.v = true; > assert(b.ready.v == false); > assert(&a.ready.v !is &b.ready.v); > > a.statReady.v = true; > assert(b.statReady.v == true); > assert(&a.statReady.v is &b.statReady.v); > } This is a slightly different issue, it's the field initializer that is tricking you into thinking it's a new instance per class, but in fact that initializer is invoked at *compile-time*. Try this: ----- class B { bool v; } class C { this() { ready = new shared B; } shared B ready; static shared B statReady = new shared B; } void main() { auto a = new C; auto b = new C; a.ready.v = true; assert(b.ready.v == false); assert(&a.ready.v !is &b.ready.v); a.statReady.v = true; assert(b.statReady.v == true); assert(&a.statReady.v is &b.statReady.v); } ----- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
