Re:The Idea of Lisp
by lemming on Friday December 16, 2016 @09:41AM
(#13193500)
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.
[ Parent
| on HN ]
An easy to follow example is Coffeescript (where everything is an expression), which transpiles in javascript (where not everything is).
Usually 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.