On 16/02/2016 8:29 PM, Ola Fosheim Grøstad wrote:

I agree with the principle, but not as a library function, because:

1. you want virtual functions to work out ok

virtual functions don't even need mangling. But even if they did it would work just fine anyway.


2. making D more reliant on macroish string processing is not good


It's not macroish string processing, it's embedding a subset of C++ declarations like a DSL. The difference is that the C++ can be fully type-checked and semantically analysed, errors will not leak into the generated source.


You would need something along the lines of:

1. «extern "C++"» the essence of the class definition in plain C++ syntax

2. add to this syntax a translation for each parameter what it means in D.


E.g.

extern "C++" {

class X {
   mutable int rc;
   virtual func1(const A* ptr); @reinterpret(ptr, head_const_ptr!A)
   virtual func2(const A* ptr); @reinterpret(ptr, const A*)
   virtual func3(A* ptr);
   virtual func4(const A* ptr); @reinterpret(ptr, const_rc!A*)
};

}


We don't 'need' compiler support beyond what we have, for any of this.

Reply via email to