Nim can certainly handle incremental conversion of both C/C++ codebases. As 
@araq says if it's possible to rewrite, it can often be smaller and easier to 
do so. However, as you mention it's not always feasible.

There's two main routes to take here:

First route: treat your current C/C++ as a library which gets compiled into 
Nim. You loose your current main, but ideally that should be easy to replace. 
Then you just move per-function and re-make things like main purely in Nim. 
This probably fits best into your incremental rewrite approach. Also, you can 
use c2nim to translate your current main to Nim which is a good first step.

Second route: create libraries from Nim that you export to the large C/C++ 
project. Effectively just declare some exportc procs that make C/C++ interop 
easy (checkout ginny for this too). This is best for large projects where you'd 
want to add Nim into it but where it's not likely for the code base to swap 
over anytime soon.

Reply via email to