I don't understand betterC
evilrat
evilrat666 at gmail.com
Sat Sep 2 06:11:57 UTC 2023
On Saturday, 2 September 2023 at 03:27:51 UTC, confused wrote:
> So I guess my next question is why, exactly, classes *can*, in
> fact, be implemented in ``` betterC ```, but are not?
IIRC you can have extern(C++) classes in betterC, the real issue
is the plain extern(D) classes which has some assumptions that
are not present in betterC runtime.
Be careful though as extern(C++) classes have a bit different
behavior where you might not expect it.
Specifically they have different vtable layout and some quirks
with regard to multiple inheritance which is not available in D.
They might have some different destructor logic, and maybe there
is more...
Otherwise you will have to mimic "classes" behavior with some
template magic, just like OOP in C similar to COM model or gtk
gobject, this means no fancy keyword and no language support for
them though. But with all the templates and CTFE this shouldn't
be a problem.
Also if you have read this forums regarding betterC... well, I
think its only valid real use cases are tiny microcontrollers and
WebAsm (because of GC), but the latter case can probably avoided
with custom D runtime and people in fact has crafted some custom
implementations.
More information about the Digitalmars-d-learn
mailing list