3 ms·
Given how similar the two languages are, I wonder how hard it would be to automate such a translation?
by weavie 12y ago
Given how similar the two languages are, I wonder how hard it would be to automate such a translation?
- pistle 12y agoMany lines would need nothing. Overarching structure, idiomatic usage, and lack of benefits from being able to use language constructs of efficiency in C# would yield sub-optimal results. Manual conversion to idiomatic C# would be a better route and add the benefits of deeper familiarity with the application. It's one thing to wrestle with a new codebase. It's another thing to try to make sense of something transcoded by a tool. Was the original coder insane or is it just an edge case in your translation tool?
- wcoenen 12y agoYou don't even have to translate anything. Bytecode translation via IKVM.NET[1] to run JVM applications on the .NET runtime works surprisingly well. [1] http://www.ikvm.net/ http://www.ikvm.net/
- ygra 12y agoOn a language level, not that hard (though the result wouldn't be idiomatic in a lot of places). But on a library and API level ... Either you move everything that uses the stdlib to your own standard library excerpt that you maintain for both languages to be identical. Or you find compatible implementations in the other language (or translate Apache Harmony to C# as well). Or you'll deal with all the things that your program could call and emit code that does the same thing in the target language, with more code where standard library functionality differs slightly. And then there is the problem of external libraries and their APIs. Either translate them as well, or find API-compatible replacements, or find replacements and handle the API differences yourself. Actually, it comes down to the same thing either way, when considering the standard library just as a library, among the others.
- Rapzid 12y agoYou might be interested to know about ngit. It's a c# git library under the mono project: https://github.com/mono/ngit https://github.com/mono/ngit . The thing is they created a tool called sharpen so they could convert most of the jgit code over to c# :)