shared - i need it to be useful

Timon Gehr timon.gehr at gmx.ch
Wed Oct 17 12:29:40 UTC 2018


On 17.10.2018 14:24, Timon Gehr wrote:
> On 15.10.2018 23:51, Manu wrote:
>> If a shared method is incompatible with an unshared method, your class
>> is broken.
> 
> Then what you want is not implicit unshared->shared conversion. What you 
> want is a different way to type shared member access. You want a setup 
> where shared methods are only allowed to access shared members and 
> unshared methods are only allowed to access unshared members.
> 
> I.e., what you want is that shared is not transitive. You want that if 
> you have a shared(C) c, then it is an error to access c.m iff m is not 
> shared. This way you can have partially shared classes, where part of 
> the class is thread-local, and other parts are shared with other threads.
> 
> Is this it?

(Also, with this new definition of 'shared', unshared -> shared 
conversion would of course become sound.)


More information about the Digitalmars-d mailing list