On Saturday, August 13, 2016 16:45:16 Steven Schveighoffer via Digitalmars-d wrote: > Hey, that's fine. I'd rather work on other things too. Shared just seems > like an unfulfilled promise, with half-implemented protections. > > I'd like to just see shared be unusable, and make people cast away > shared to do anything. That at least is an attempt at preventing races > without intention. The allowance of certain things that are obvious > races, whereas other things that are obvious races are prevented makes > one assume the worst.
I'm also tempted to argue that making shared virtually unusable without casting it away would be a good idea - particularly when you consider that most code that uses shared is going to need to cast it away to do anything with it (even if we had synchronized classes, that would still be the case - it would just be that under some circumstances, the compiler would do it for you). Maybe we don't want to go quite to the point that you have to cast away shared to do anything other than pass it around (we probably have to have assignment still not involve casting even though that would normally need to be protected by a lock), but I do think that that's the direction that we shoudld be leaning in. However, it sounds like Walter wants to postpone discussing this seriously until after scope is sorted out. I think that it's clear that Walter and Andrei agree that some work needs to be done on formalizing shared, and maybe it should be pushed soon, but it sounds like we should wait until after this DIP is sorted out to really get into it. It _is_ one area that we need to make sure that we have done though. I think that the basics of how shared has been done are right, but we do need to make sure that the details are sorted out correctly and that it's clear how shared should be used, since as it is, way too many folks just slap __gshared on stuff if they want it to be shared (which is almost always the wrong thing to do). - Jonathan M Davis