union mutability

Jack Applegame via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Aug 25 12:42:35 PDT 2016


On Thursday, 25 August 2016 at 19:19:49 UTC, Jonathan M Davis 
wrote:
> Why? I don't know exactly what that PR is supposed to do, but 
> std.datetime uses immutable time zone objects, and if that PR 
> made it so that you couldn't have an immutable instance of a 
> class, then it would have failed the auto-tester. And it 
> clearly doesn't stop having unions with immutable members, or 
> it would have failed to compile because of Rebindable (though 
> it may be that Rebindable can no longer be used in @safe code).
>
> - Jonathan M Davis

Because lack of mutable references to immutable classes in @safe 
code is big PITA for me. It is easier to not use immutable 
classes at all.




More information about the Digitalmars-d-learn mailing list