5 ms·
Cool, has anyone made something similar for Clojure?
by mcav 13y ago
Cool, has anyone made something similar for Clojure?
- zindlerb 13y agoIsn't the whole idea of clojure that it is built on JVM?
- tel 13y agoI'd say it's an somewhat important side point... But Clojure already cross-compiles to Javascript.
- sreque 13y agoThere have been a number of not-quite-successful attempts in the past to compile Scala to Javascript. The latest and most promising seems to be https://github.com/lampepfl/scala-js https://github.com/lampepfl/scala-js
- lmm 13y agoSo is scala, and scala already interoperates with java code. But it's still nice to be able to turn your legacy java code into scala and have all your code in a single language.
- cynicalkane 13y agoUnlike Scala, having Java-style code in Clojure yields no advantages. You just end up with something like Java, but with less type safety and more parentheses. It also makes a lousy start for refactoring since effective Clojure is so much about figuring out how to shape your code into nested S-Expressions, so you'll end up nuking most of your auto-converted Java "statements".
- elangoc 13y agoClojure doesn't lend itself to doing that. Perhaps the easiest (albeit simplistic) way to describe the difference between Clojure and Scala -- Scala supports OOP and FP, and Clojure supports FP only as part of a holistic (and refreshing) vision of how high-level programming is done. Even if it were possible to do so in Clojure, you probably wouldn't want to. There are usually ways to do the same things in Clojure that makes your code simpler, and as a result, in much less code. Part of the Clojure philosophy is to make things simpler, even if it isn't always 'easy' at first relative to the individual talking. Even though using a code translation tool is easy, figuring out how to use functions and macros to abstract away repetitious code blocks and patterns from your code is well worth it in the medium- and long-term.
- coolsunglasses 13y agoClojure has OO faculties too, just not in one big tangled ball of mud like Scala and Java.
- elangoc 13y agoyou're right, and Clojure extends the power/flexibility of certain constructs in OOP world, like making dynamic dispatch based on arbitrary types (not just the name of a concrete subclass of a polymorphic superclass)