top | item 28397893

Joker: A small interpreted dialect of Clojure written in Go

183 points| rcarmo | 4 years ago |joker-lang.org | reply

71 comments

order
[+] didibus|4 years ago|reply
Some clarification for those interested:

Joker is not a dialect of Clojure hosted on the Go runtime. Joker is a dialect of Clojure using its own interpreted runtime, that happens to be implemented in Go.

That means you cannot use Joker to build statically linked Go binaries and you cannot interop with Go from your own code.

And if you're interested in the idea of having an interpreted implementation of Clojure, for scripting use cases and fast startup, I would recommend you look into Babashka instead of Joker: https://babashka.org/

Joker was the best interpreted Clojure prior to Babashka, and nowadays, I would recommend Babashka over Joker all the time.

The reason Babashka is better than Joker for this is that it is implemented in Java, so it can directly reuse the existing Clojure implementation and libraries as-is as part of its interpreter. That allowed it to quickly surpass Joker in the amount of Clojure features it support and libraries it exposes, and continue to quickly keep up with Clojure. I'd also say the main developer behind Babashka is more active.

Even though Babashka is implemented in Java, it is still a single statically linked binary runtime that starts extremely fast and has a small memory footprint.

Kudos to Joker though for pioneering the idea and leading to Babashka.

Edit: And if you were excited because you thought this would let you write compiled statically linked binaries in Clojure, well for that you want to look at GraalVM native compilation which lets you compile real Clojure programs as low memory, fast startup, statically compiled single binaries: https://github.com/lread/clj-graal-docs

[+] didibus|4 years ago|reply
A small correction, Babashka is implemented in Clojure, not Java, but, as such, it can also make use of Java libraries as part of its implementation. So Babashka can bundle both Clojure or Java libraries inside itself.
[+] masijo|4 years ago|reply
This project looks awesome, though I'm a bit sad that "performance" is a non-goal as stated in the README. Clojure being able to compile to a single shippable binary is just what I need in my life. Kudos to the author.
[+] skybrian|4 years ago|reply
It’s difficult to write a fast interpreter in Go. It doesn’t optimize interpreter inner loops particularly well, you can’t do the data structure tricks you can do in C, and there is no JIT compiler available like in Java.

The best way forward might be an option to compile some Joker code by generating Go code for it.

(This is based on writing an interpreter a few years ago. Perhaps Go’s compiler has improved?)

[+] vnorilo|4 years ago|reply
I have long had the ambition to be the N:th guy to try Clojure on C++. For similar reasons. I have a pretty good idea how to do it, already got HAMT and some macroexpanded code to work. But then you remember how even ClojureCLR struggled at times, and that you'd be lightyears behind that, not to speak of CLJ/CLJS, and alone. Maybe one day? :)
[+] zerr|4 years ago|reply
What would be the advantage over other Lisps if you won't be able to leverage JVM ecosystem?
[+] didibus|4 years ago|reply
You can just use GraalVM for that. Also, Joker does not let you do what you want, it is not Clojure hosted on the Go runtime, it is a Clojure interpreter runtime implemented in Go, so with Joker you always need the joker binary.

If you want to produce native shippable statically linked binaries with Clojure look at GraalVM native compilation:

https://github.com/lread/clj-graal-docs

[+] cutler|4 years ago|reply
For me the most interesting compilation target for Clojure is Dart. Writing Flutter apps in Clojure would be the dog's spherical objects. David Nolen thinks likewise and has commented on it in a recent defn podcast. Christophe Grand and Baptiste Dupuch are the brains behind it: https://twitter.com/cgrand/status/1350063059864346624?lang=e...
[+] didibus|4 years ago|reply
Has Flutter really become that popular and awesome? I feel I'm still seeing a lot more of React Native or Electron and other JS based front-ends in the wild, for which ClojureScript is best suited. I'm not sure I'm convinced Flutter will be able to break through those even with Google behind it.
[+] Zababa|4 years ago|reply
This would go really well with https://cyclone.thelanguage.org/.
[+] eggy|4 years ago|reply
I realize the project is no longer being developed by the original group, but is there a recent fork by others or version of cyclone for 64-bit computers?

I've given up on Rust for me personally, but I think it is a great PL and effort. I am still playing with Zig, but I would love to just leverage my C background, and see if Cyclone eases me away from always coding in C.

[+] Joker_vD|4 years ago|reply
Hey! That's my name! :) Incidentally, I also have a small language also implemented in Go although it's actually called "🃏".

So it's a Clojure REPL and linter/formatter? Why have REPL at all then?

[+] stcredzero|4 years ago|reply
Why have REPL at all then?

To many, interactive development and debugging is the main point of the Clojure REPL. (Also true for many dynamic languages.) I take it you don't code and debug using such techniques. Some feel they are a revelation.

[+] stefanos82|4 years ago|reply
Am I the only one who sees Duke, the Java mascot in logo?
[+] emacsen|4 years ago|reply
The Eclipse Public License is a showstopper for me. :(
[+] vnorilo|4 years ago|reply
It's quite common in Clojure circles. Care to elaborate? Not copyleft?