also related: https://github.com/Syniurge/Calypso/issues/85
(feasibility of extending calypso to do source to source translation
(eg C++ => D or C=>D) )
On Thu, Feb 22, 2018 at 12:43 AM, ketmar via Digitalmars-d-learn
> Nick Sabalausky (Abscissa) wrote:
>> Are there any tutorials or articles out there for "getting started with
>> converting a C++ codebase to D one module at a time?" Or at the very least:
>> tips, tricks, lessions learned, from those who have come before.
> from my experience (various codebases up to middle size, mostly C, some
> C++): fsck the "one module at a time" idea! even in D modules are
> interwined, and in C and C++ they're even more so. besides, converting tests
> is tedious, it is much funnier to have something working.
> so, i'm usually converting alot of code, up to the whole codebase. it is not
> fun when compler spits 100500 errors, but when it finally stops... oh, joy!
> trick: use 'sed' (or your favorite regexp search-and-replace tool) alot.
> basically, before HDD crash i almost had a set of scripts that does 80-90
> percents of work translating C to D with sed. ;-) then use editor with "jump
> to error line" support, and simply compile your code, fixing errors one by
> tip: try to not rewrite code in any way until it works. i know how tempting
> it to replace "just this tiny thing, it is so ugly, and in D we have a nice
> idiom!" NEVAR. this is by far the most important thing to remember (at least
> for me), so i'll repeat it again: no code modifications until it works!
> personal memories: C code often using things like `a == &arr[idx]`, where
> idx can go just past the last array element. it got me when i was doing enet
> conversion. nasty trick.
> otherwise, sweat and blood, and patience.