Are D classes proper reference types?

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Sun Jun 27 12:00:41 UTC 2021


On Sunday, 27 June 2021 at 10:11:44 UTC, kinke wrote:
> It's not about classes using monitors themselves, it's about 
> people potentially using `synchronized (obj)` for some 
> arbitrary class reference `obj`.

I wasn't aware this was a thing. If people want this they can 
just embed a mutex in the class themselves. No point in having it 
everywhere.  You usually don't want to coordinate over one 
instance anyway.

> Sure, 'just' :D - as it 'just' takes someone to implement it 
> (for all supported C++ runtimes). It's always the same problem,

Right, but what does all supported C++ runtimes mean? I thought 
LDC was tied to clang, which I guess means two runtimes? If C++ 
doesn't use arbitrary negative offsets, then D could use those?



More information about the Digitalmars-d-learn mailing list