Why can't we transpile C++ to D?

evilrat evilrat666 at gmail.com
Thu Jun 10 19:25:26 UTC 2021


On Thursday, 10 June 2021 at 19:06:42 UTC, Tejas wrote:
>
> But how scalable will this be? We have to get real D code to 
> enrich our ambiguously-defined-small ecosystem.

It says bindings generator, but it has to convert the code 
keeping the semantic as close as possible.

It does direct translation on AST level (AST-to-source 
currently), there is quirks here and there, semantic 
discrepancies(for example sizeof/alignof differs in D vs C++), 
lack of struct inheritance and multiple inheritance, and other 
annoying stuff like implicit casts or implicit constructors, but 
overall this should work.

Definitely better than doing it all by hand.
I tried to run it on clang, phew, got 241k lines, and that's 
without .cpp files. Haven't even bothered with fixing it to 
compilable state (even then it will definitely have linking 
issues).



More information about the Digitalmars-d-learn mailing list