Accessing C++ code from D

Mike Parker aldacron71 at yahoo.com
Thu May 18 19:13:53 PDT 2006


Ben Cooley wrote:

> 
> Yes it certainly should support interop if there is any real intention of being
> a successor to Cpp.  

No it shouldn't. D is trying to break away from C++, not extend it.

> 
> And Yes, interop issues are part of the reason why the new .NET system is
> gaining ground against Java.  Both microsoft C# and Cpp have interop with
> eachother.  C# has unsafe code, which is completely compatible with C and Cpp,
> and Cpp has complete interop with the .NET world, including C#.

C# was designed from the beginning to run on CLI. CLI was designed so 
that multiple languages could share the same resources and talk to each 
other. D had no such design goals.

> 
> Outside of the D forums in the general programming world these issues are not
> really controversial.  They are considered self evident and obvious.  This is
> why D is not a real alternative to Cpp or C for most programmers.  

All of the D community comes from /outside/ of the D community, and most 
of us still live and work there. In my world, what you are saying just 
isn't true. You focus too much on C++, your circumstances, and the 
circumstances of people you know. The general programming world is much 
larger than that. I don't give a rat's ass about C++ interoperability. 
Most people I know wouldn't give a rat's ass about it either. I know C++ 
programmers who would happily switch over and use D for all of their new 
projects once their bosses approve it.

But why should would you stop with C++ interoperability? What all of the 
Java code bases out there? Surely they would be more likely to come to D 
if they could use their existing code. What about the C# programmers? Or 
the VB programmers? Why not just develop our own Common Language 
Interface? Because that's not the design goal behind D.

D isn't meant to just be a replacement for C++. It melds the features of 
several languages, along with new ideas, into something that is an 
excellent /alternative/ to many existing languages, not just C++. C++ 
interoperability would only be useful to a small subset of potential D 
users, not the masses to whom you claim it is self evident.

Obviously, D isn't going to be suited to every project. If you rely on a 
few million lines of C++, Java, or other code (besides C), then D isn't 
the best solution for leveraging that code base. But I just don't see 
how that is going to be a deal breaker for D's acceptance. I think the 
problem is much smaller than you let on.



More information about the Digitalmars-d mailing list