synchronized - shared but actually useful

FeepingCreature feepingcreature at gmail.com
Tue Oct 23 08:56:39 UTC 2018


1. Make synchronized an attribute of fields, classes and methods
2. synchronized methods are synchronized(this) wrapping 
inconditions, outconditions, invariant checks and the main body. 
They are thus actually safe, as opposed to the status quo where 
invariants have to be synchronized separately and are thus Worse 
Than Useless™.
3. synchronized classes consist of synchronized fields and 
synchronized public methods
3.1. Only synchronized subclasses may inherit from synchronized 
classes, and vice versa.
4. immutable data is implicitly synchronized. Local variables are 
implicitly synchronized.
5. Synchronized methods must not allow mutable references to 
escape, unless they are to synchronized objects.
6. in @safe, only synchronized methods may access synchronized 
fields.

Advantages:
* simple
* does something useful
Disadvantages:
* inability to generate giant forum debates (fingers crossed)



More information about the Digitalmars-d mailing list