Structs as reference types?

Alexandru Ermicioi alexandru.ermicioi at gmail.com
Sun May 30 07:04:29 UTC 2021


On Sunday, 30 May 2021 at 00:39:59 UTC, tsbockman wrote:
> No, a final class in D still has a `size_t.sizeof * 2` header 
> containing a virtual function table pointer and a monitor, 
> because all `extern(D)` classes are implicitly derived from

> Aside from the wasted space, the `final class` version isn't 
> compatible with `extern(C)` interfaces like the `struct` 
> version is.

 From the looks of the request, what he wanted is to have mainly 
reference semantics, which classes already have.

Well true, it is fatter if not marked as extern(c++) as evilrat 
mentioned.

It would be nice if the proto object proposal would get 
implemented. It would cleanse a bit the Object hierarchy and 
would allow use classes as structs (well still a bit fatter) 
without extern (c++).


More information about the Digitalmars-d mailing list