C++ constructors, destructors and operator access

Daniel Murphy yebblies at nospamgmail.com
Sun May 19 06:56:47 PDT 2013


"Igor Stepanov" <wazar.leollone at yahoo.com> wrote in message 
news:wuevxraaffhaaceapqfv at forum.dlang.org...
> Is this mean, that D functions will _not_ create C++ objects with new?
> For example:
> You have moved parser to D, but you haven't moved expressions to D yet.
> And you want to create new Expression object in parser (in D code), but 
> Expression class defined in C++. What will you do in this case?

This is not how we're moving it.  The entire frontend will be moved in one 
go, there will never be a need to create a C++ class from D.

That said, the glue layer will remain in C++ and will need to create 
instances of classes defined in D.  The current glue layer calls 43 
different constructors.

I don't have a solution for this yet, but it will probably be:
a) Extend D to allow creating classes with constructors callable from C++
b) Create/generate factory functions for each class new'd in the glue layer
c) Remove all class allocations from the glue layer

I'm leaning towards b, or maybe c, and I think you should too. 




More information about the Digitalmars-d mailing list