Shared

Stefan Koch uplink.coder at googlemail.com
Sat May 11 12:08:00 UTC 2019


On Saturday, 11 May 2019 at 09:51:41 UTC, Dominikus Dittes 
Scherkl wrote:
> I've followed the AGM a little and think, why not go with the 
> "disable access to shared" approach, but instead of allowing it 
> to be casted away, introduce a "locked scope" lock { } which 
> need to be within a function and allow access to shared 
> variables only within such blocks?
> It's still up to the user to ensure that such locked blocks 
> encapsulate the semantic blocks which need to be kept together 
> to safely modify shared variables, but at least the compiler 
> can make sure they are not modified outside locked blocks and 
> that at any time only one such block is executed on any thread. 
> And such blocks should be scarce so they can be examined 
> carefully like trusted and everything build upon is verifiable 
> safe.

And leave shared in the useless state that it currently has?
+ introducing a new syncronized keyword? (locked)?

doesn't sound too compelling.


More information about the Digitalmars-d mailing list