Assignment of shared values

Sean Kelly via Digitalmars-d digitalmars-d at puremagic.com
Thu Aug 7 10:12:30 PDT 2014


On Wednesday, 6 August 2014 at 23:01:11 UTC, Andrei Alexandrescu 
wrote:
> I'd submitted https://issues.dlang.org/show_bug.cgi?id=4130 
> which is related to issues with shared values assignment.
>
> Consider:
>
> struct S { long a, b, c; ... }
>
> Should it be safe to assign one S to another? I guess not 
> because assignment would violate whatever invariant a, b, and c 
> may hold, and there's too much state to be assigned atomically.

But isn't it required that structs allows bit copying?  Perhaps 
it's simply invalid to have a shared struct at all?  Which in 
turn suggests that naive transitivity of shared isn't correct.


More information about the Digitalmars-d mailing list