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.
  • Re: I don't unde... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
    • Re: I don't... confused via Digitalmars-d-learn
      • Re: I d... bachmeier via Digitalmars-d-learn
        • Re:... confused via Digitalmars-d-learn
          • ... bachmeier via Digitalmars-d-learn
      • Re: I d... evilrat via Digitalmars-d-learn
        • Re:... confused via Digitalmars-d-learn
          • ... Jonathan M Davis via Digitalmars-d-learn
      • Re: I d... ryuukk_ via Digitalmars-d-learn
        • Re:... confused via Digitalmars-d-learn
          • ... evilrat via Digitalmars-d-learn

Reply via email to