On Tuesday, 13 October 2015 at 06:58:28 UTC, Andrei Alexandrescu
wrote:
https://github.com/D-Programming-Language/dmd/pull/5188
implements a rule defined in TDPL: synchronized classes shall
have no public members.
The motivation behind this limitation is that member accesses
in synchronized objects should not occur without some handshake
occurring. Public members would make that possible and easy.
Walter and I are on board with this change. However, it is a
breaking change so we want to gather a level of community
support before we push the button.
Thanks,
Andrei
Ignoring the issue of whether synchronized should actually exist,
this makes sense to me. Any class that expects to be thread-safe
should not allow public access to fields as that's inherently not
thread-safe. Code breakage would exist, but if the user really
wants to maintain the same logic, they could just use @property
in the vast majority of cases.