4 ms·
> we switched our production JVM to GraalVM, which opened a new possibility since it comes with GraalJS, a JavaScript engine which aims to compete with today's
by refset 7y ago
> we switched our production JVM to GraalVM, which opened a new possibility since it comes with GraalJS, a JavaScript engine which aims to compete with today's faster JavaScript engines like V8 and JavaScriptCore on performance. It lets us embed the ClojureScript app into our Clojure app so it can perform the rendering in-process in the JVM
> GraalVM's polyglot abilities to load the JavaScript artifact from the ClojureScript app into the Clojure JVM and directly call the function with almost no overhead
I think Clojure is uniquely positioned here in its ability to fuse these JS<->JVM technologies using a single language and, in this instance, fully supplant the need for nodejs. Very impressive!
- chrisjc 7y ago> I think Clojure is uniquely positioned here in its ability to fuse these JS<->JVM technologies using a single language Why? Aren't there a lot of other languages that do the same? What is different about Clojure? Genuinely interested!
- fulafel 7y agoFew languages can run the same code on both JS and JVM. Of those Clojure is probably the most production-quality.
- chrisseaton 7y agoMore production quality than JS itself?
- deleted 7y ago[deleted]
- iLemming 7y agoThat is very true. Even spending years writing nodejs projects I have never felt what truly "code-reuse" is about. Even with the same language being on both sides there's a huge difference between front-end and back-end. I was surprised to find out - Clojure lets you do that so elegantly, even though you essentially on two, completely different platforms much of the code can be re-used.
- refset 7y agoThe sibling response from fulafel is definitely the central argument. I would also add that Clojure has excellent production-quality "interop" with all of its host languages, such that end-to-end ergonomics are relatively painless e.g. CLJS<->JS<->Graal Polyglot<->Java<->Clojure There was briefly (now deleted) a response to fulafel's comment which essentially pointed out how JavaScript itself should be considered a production-quality language that is up to the task. After all, JavaScript can also now be used to build JVM applications thanks to GraalJS ...except I wouldn't bet on that technology direction gaining much traction at this point in time (unless maybe Oracle has a trick up its sleeve).
- cljs-js-eval 7y agoClojure has "reader conditionals" which enable you to write a single file and only have divergent code paths when you need to do something that is JVM or JS specific (or CLR-specific, if you're into that). It's super helpful for shared libraries. A lot of our code can be shared between JVM servers, JS lambdas, or JS frontend code without much development effort. It's mostly just a matter of naming a file .cljc and you're off to the races.
- pjmlp 7y agoKotlin and Scala have it as well.