Automated source translation of C++ to D

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Thu Aug 21 14:06:15 PDT 2014


On 8/21/2014 10:57 AM, Joakim wrote:
> Given tools like libclang, how hard do you think it'd be to translate most of
> actual C++ to D?

I'd say the possibility of that is about zero. Heck, we can't even do it 100% for C.

The trouble is, D is not a perfect superset of C++, not even close:

1. multiple inheritance
2. SFINAE
3. Koenig lookup
4. tail mutability
5. overloading rules
6. operator overloading rules
7. fwd reference issues
8. macros (it's depressing how much modern C++ practice still heavily depends on 
the preprocessor)

Does that really matter? In my not-so-humble experience, C++ programmers often, 
far too often, find some odd corner case in the language and build an entire 
store on it. I personally find this baffling, but it happens with depressing 
regularity.

(In contrast, the C++ style used in DMD is very conservative and tends to run 
right down the middle of the road of C++, avoiding anything clever and corners 
and weird emergent behavior. This is the only reason why DDMD has even a prayer 
of working.)


More information about the Digitalmars-d mailing list