Hacker News new | ask | show | jobs
by marcrosoft 2740 days ago
Congrats. I'm trying to learn Common Lisp for great good. And, I love that lisp is still alive. I think we still haven't learned all that lisp has to offer.

For me personally, I think Clojure (or any lisp) targeting Go would be awesome.

The JVM lacks a killer Go "feature" which is _native binaries/easy deployment. Common lisp and many other lisps lack community which is why I think Go+Lisp would make a great combo. Go, even though it is a new language, already outpaces (a much older) Common Lisp as far as libraries go due to the huge community Go has.

I know there is `zygomys` but it doesn't reach Clojure popularity/maturity.

Can Clojure target Go?

Edit:

Maybe it is infeasible but I think targeting JVM, Go, and JavaScript would give Clojure a ridiculous advantage over almost any current programming language.

6 comments

No need for Go, GraalVM already allows you to create a native binary:

https://www.innoq.com/en/blog/native-clojure-and-graalvm/

As fcurts below mentioned, [Graal's native image generation](https://www.graalvm.org/docs/reference-manual/aot-compilatio...) might be what you want.

It can turn a Clojure app into a single executable with excellent performance and memory characteristics.

You might be interested in joker (a small Clojure interpreter and linter written in Go) https://github.com/candid82/joker
The JVM supports AOT native binaries since the early 2000's, just not for free.

All major commercial JDKs have such support, e.g. PTC, Aicas, IBM J9, IBM RealTime WebSphere, Imsys, Excelsior JET.

Additionally OpenJDK has been integrating such support since Java 9 via Graal and GraalVM.

All you'd need is a Clojure to Go compiler. A simple matter of implementation (joking). The good news is that Clojure is relatively easy to tokenize and has a simple grammar. Go v1's lack of generics would make the implementation tedious, but the features announced for Go v2 should make it easier.
A more feasible option is to compile Clojure byte code to native code with GraalVM (http://www.graalvm.org/docs/reference-manual/aot-compilation...). GraalVM's native compiler still has some limitations but is coming along nicely.
you might want to have a look at Joker (https://joker-lang.org/)

It's a Clojure dialect written in Go. Currently, its mostly used as a linter but you can also do programming/scripting.