I am aware of ClojureScript – possibility to compile clojure code to javascript, but is it possible to do the reverse, take some subset of javascript code and translate it back to clojure?
I am aware of ClojureScript – possibility to compile clojure code to javascript, but
Share
Yes, although it wouldn’t really make sense.
Clojure -> JavaScript makes sense because:
Clojure would be an odd choice for a target language – if you want to run on the JVM platform, it would be more natural to target Java bytecode directly.
JavaScript would also be an odd choice for a source language compiling to Clojure – if you want Clojure code, why would you not just write Clojure directly? In particular, using a (possible subset of) JavaScript would not give you easy access to all the features that make Clojure really compelling (lazy functional programming, concurrency support, macro metaprogramming , persistent data structures etc.)