6
votes

I am just wondering if it would make sense to implement Clojure on top of Googles V8 Javascript engine. I never use Java interoperability. I also am learning ClojureScript. So I could see an advantage of having clojure running on the V8 engine.

Any thoughts on this? Is anyone doing this? How hard would it be?

2

2 Answers

18
votes

ClojureScript can already run on top of V8 outside of the browser and has been able to since the very beginning. In particular, the test suite and the benchmark suite get executed in V8 if the path to V8's directory is provided to the runner scripts (via an environment variable); besides V8, SpiderMonkey and JavaScriptCore are being used in this way.

Node.js adds a full standard library to V8 and has been a valid compilation target for ClojureScript since the initial release. As for the state of the art, JohnJ's reference to Bodil's presentation is a good one (see also Bodil's projects like cljs-noderepl and Dog Fort).

Now, ClojureScript lacks certain features of Clojure, notably runtime access to the compiler, but there is a fork with the compiler ported to ClojureScript. A self-hosted ClojureScript release is probably a matter of time.

1
votes

Check out Bodil Stokke's video, "ClojureScript All The Way Down," where she builds a full-stack Web application on top of Node.js.