Since only functions performing a single operation on a
single shared operand can accept shared variables, it is
practically impossible to use shared mutable data in
generic algorithms.
Assuming that with this premise user code will always use a
mutex to secure access to shared data, developers would end up
with many casts from shared to unshared.
So here is UNSHARED, a new scope modifier:
synchronized(mutex) unshared(this.count, this.list)
{
// do something with the now unshared count and list
}
This puts the mutex and the variables protected by it in
relation in the code and removes superfluous casts.
--
Marco

Since only functions performing a single operation on a
single shared operand can accept shared variables, it is
practically impossible to use shared mutable data in
generic algorithms.
Assuming that with this premise user code will always use a
mutex to secure access to shared data, developers would end up
with many casts from shared to unshared.
So here is UNSHARED, a new scope modifier:
synchronized(mutex) unshared(this.count, this.list)
{
// do something with the now unshared count and list
}
This puts the mutex and the variables protected by it in
relation in the code and removes superfluous casts.

We don't need new qualifier for that, implementing `scope` will
do the trick among other tricks. Locking can safely cast shared
into scope without breaking type system. And you will need same
safety checks for implementation of "unshared" anyway
(prohibiting storing references)