Optional monitors suggestion

Damian Day via Digitalmars-d digitalmars-d at puremagic.com
Wed May 14 06:53:50 PDT 2014


On Wednesday, 14 May 2014 at 11:06:43 UTC, Yuriy wrote:
> bearophile, good point. What do you think of the following 
> solution:
> 1. Declaring member variable with __monitor identifier is 
> disallowed.
> 2. class may be defined with @__monitor attribute, in which 
> case a __monitor variable will be added to it's beginning.
> 3. Subclass of such class may again be defined with @__monitor 
> attar, in which case it will be simply ignored, as it already 
> inherits __monitor from super.

These would be breaking changes. I see the benefit but...

If the compiler recognizes the class using synchronized, it could
use a little magic and add a monitor variable itself, this would
not cause any breaking change.


More information about the Digitalmars-d mailing list