Are D classes proper reference types?

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Sun Jun 27 09:46:45 UTC 2021


On Sunday, 27 June 2021 at 08:41:27 UTC, kinke wrote:
> Getting rid of the monitor field was discussed multiple times.

You don't have to get rid of it, just implicitly declare it for 
classes that use monitors? I don't think it has to be at a 
specific offset?

> The other major and not so trivial difference is that 
> extern(C++) classes have no TypeInfo pointer (in the first 
> vtable slot for extern(D) classes), which also means that 
> dynamic casts don't work, neither in D nor in C++ (for the 
> latter, only for instances instiantiated on the D side). 
> [AFAIK, most C++ implementations put the - of course totally 
> incompatible - *C++* TypeInfo into vtable slot -1.]

But D could just extend C++ typeinfo?




More information about the Digitalmars-d-learn mailing list