Assignment of shared values

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Thu Aug 7 05:25:07 PDT 2014


On Wednesday, 6 August 2014 at 23:01:11 UTC, Andrei Alexandrescu 
wrote:
> Somewhat sadly, this code does compile:
>
> shared S s1, s2;
> s1 = s2;

I have no idea what semantics this may have from just reading the 
snippet. IMHO killing it will be a good thing and totally in line 
with your comments about shared you have made during DConf 
conversations.

> However, assigning Variant objects holding such structs does 
> not compile, which in turn leads to the reported bug in 
> std.concurrency. Now it seems to me that the only way is to 
> adapt Variant to allow such assignments, otherwise we'd be 
> breaking existing code. Thoughts appreciated.

I think biggest std.concurrency problem is that people try to use 
`shared` as poor replacement to `unique`/`isolated` and this is 
not what it is supposed to mean. Making `Unique` work with 
std.concurrency can be a good direction to make things much less 
confusing.


More information about the Digitalmars-d mailing list