3 ms·
Is there any literature on how to translate languages where everything is an expression to ones where it isn't, for example when compiling/transpiling to java?
by lemming 10y ago
Is there any literature on how to translate languages where everything is an expression to ones where it isn't, for example when compiling/transpiling to java? If/then can be translated to the ternary operator, but terms like try/catch are trickier.
- wtetzner 10y agoUsually when I'm faced with putting a try/catch in an expression in Java, I end up wrapping it in it's own method. It's not the nicest solution, but it would allow targeting Java without disrupting the code structure too much.
- corecoder 10y agoAn easy to follow example is Coffeescript (where everything is an expression), which transpiles in javascript (where not everything is).