D vs C++ classes?

Alexandru Ermicioi alexandru.ermicioi at gmail.com
Wed Jun 30 00:07:46 UTC 2021


On Tuesday, 29 June 2021 at 06:52:03 UTC, Ola Fosheim Grøstad 
wrote:
> On Monday, 28 June 2021 at 23:17:36 UTC, Bruce Carneal wrote:
>> Making a new feature optional does not, of course, actually 
>> make it free.  The cost includes, minimally, the cost of 
>> implementation and maintenance over the life of the 
>> compiler(s) and the debugging costs incurred by programmers 
>> encountering bugs in the, potentially complex, new compiler 
>> code.
>
> The complexity that comes with multiple inheritance is the 
> offset to the ancestor class, but that is already solved by the 
> C++ ABI one chooses to conform to.

This will basically cut any research and potential improvements 
into the compiler regarding oop that rely on type information 
being coded inside abi, right?
Should we sacrifice any possible future improvements for this?
What about additional annotations that are embedded in mangled 
name for the class methods?

> Still, C++ is what it is, so compilers have to deal with it 
> regardless. Unifying C++ and D classes gets rid of one language 
> construct (The D class). So it does make the language simpler 
> for the user in my view.
I personally don't think this is right approach. We basically are 
running after C++ to just add this interop stuff, while limiting 
ourselves in growth of oop aspect of D.

I think the best alternative here would be to allow c++ class 
declarations (extern c++ ones) to be able to express multiple 
inheritance and other things related to c++ classes, rather 
bounding native D classes to c++ abi.

Best regards,
Alexandru.



More information about the Digitalmars-d mailing list