[dmd-concurrency] there is no escape
Andrei Alexandrescu
andrei at erdani.com
Wed Feb 3 23:03:09 PST 2010
It looks like there is agreement that there is no escaping of any
reference to an object's fields from within a method of a synchronized
class. Inside a method of a synchronized class, effectively all members
are transitively scoped.
This is quite restrictive, but it's the right thing to do with the
expressive abilities we now have. I think it's possible D3 will add some
capabilities, but for the time being it looks this is it.
One possible improvement is, as discussed, defining "scope" as a storage
class for function parameters. I now remember a number of additional
difficulties related to that when Walter and I discussed things a few
months ago. One issue was that the storage class has to be transitive,
which makes it an odd beast. Making scope a qualifier would be the right
thing to do, but then too many qualifiers make the language quite baroque.
As we already knew, shared/synchronized limit quite drastically the
range of lock-based designs without casts. Fortunately, using a class
reference member inside a synchronized object will be possible
because... well I'll explain in the text.
I continue to believe this is the right bet to make, but I expect push
back from experienced lock-based programmers.
Andrei
More information about the dmd-concurrency
mailing list