I have heard of some compilers that convert code in one high level language to another
e.g Shedskin that converts python code to optimized C++.
I was wondering why would one ever try to do that. Why not directly write in the desired language itself?
The only reason I could think of was may be compiled languages like C/C++ are better than interpreted ones performance-wise.
Any more insights are welcome.
It is often handy to convert one part of a codebase into a different language if you want to reuse that code in another project.
For example, say you had a python application which used some handy utility functions. Later, you're writing a C++ application, and need that same functionality.
You have two options - either use some form of bridge to call the python code from C++ (which can be clunky at times, although it is possible), or rewrite the routine in C++. Translation tools can simplify the second option.