Deprecate synchronized classes please!

frame frame86 at live.com
Wed Sep 7 13:33:12 UTC 2022


On Tuesday, 6 September 2022 at 11:16:19 UTC, Loara wrote:

>> If all members becomes atomic inside a synchronized class, 
>> then it's a design error. The whole point of a synchronized 
>> class is that the members should be normal variables and not 
>> atomics.
>
> This is the reason behind error message I've posted. Currently 
> synchronized classes exists only as a mirror of Java's 
> synchronization mechanism, but without a well integration with 
> D ecosystem. Maybe we should rethink entirely `synchronized` 
> inside D.

I would also like to know the reason for this. The shared 
inference is nothing the user expects or asked for. And It only 
affects methods not fields + you can instantiate the class 
wihtout constructor as non-shared but need shared if you want a 
custom constructor, making this behaviour even more inconsistent.


More information about the Digitalmars-d mailing list