On Tuesday, 31 March 2015 at 20:37:37 UTC, Jeff Jones wrote:
Is it possible to modify either a C++ compiler or in code to
make classes more D ish? e.g., instead of just the
vtable(which, IIRC is slightly different between the two) add
the metadata pointer and whatever else?
What I'm getting at, is there a somewhat simple way(not
creating a new C++ but either through macros, small compiler
changes, or whatever) to make C++ objects D compatible instead
of the other way?
I.e., we can't take anything away from D classes since we will
break D. But we should be able to add to C++ classes without
breaking C++. If we can add the info that D needs then both
should get along happily? I'm mainly talking about a simple
code based solution but I'm also curious about how easily this
would be by compiler modification.
As far as I understand, the memory layout is already compatible.
The problematic part seems to be construction. I'd say it's
difficult to change anything about that on the C++ side, but I'll
let others answer who are more familiar with the inner workings
of the compiler.