Is it feasible to slowly rewrite a C++ codebase in D?

Seb seb at wilzba.ch
Tue Jul 10 20:28:00 UTC 2018


On Wednesday, 20 June 2018 at 18:47:10 UTC, Jordi Gutiérrez 
Hermoso wrote:
> I'm specifically thinking of the GNU Octave codebase:
>
> http://hg.savannah.gnu.org/hgweb/octave/file/@
>
> It's a fairly old and complicated C++ codebase. I would like to 
> see if I could slowly introduce some D in it, anywhere.
>
> Now, as I understand it, I would need to begin with making 
> `main` a D function, because D needs to initialise the runtime. 
> Is this correct?
>
> Another possibility might be in dlopen'able functions. 
> Currently Octave uses so-called oct functions, which are 
> nothing more than C++ object code that is dynamically loaded by 
> the interpreter at runtime. They are compiled to the Octave C++ 
> API, but we also have a Matlab-compatible C API that perhaps 
> could be more amenable for D-ification.
>
> What are your ideas?

Maybe looking at the recent DMD Backend to D conversion PRs 
(https://github.com/dlang/dmd/pulls?utf8=%E2%9C%93&q=is%3Apr+label%3A%22D+Conversion%22+) helps?
Here -betterC is used.

The frontend was automatically converted to D a few years ago 
(https://github.com/dlang/dmd/tree/last-cdmd/src/magicport), 
though magicport was a bit specific to DMD's codebase.


More information about the Digitalmars-d-learn mailing list