Live data from Hacker News

Joker: A small interpreted dialect of Clojure written in Go

joker-lang.org

21–30 of 73 posts

Re: Joker: A small interpreted dialect of Clojure written in Go

#21
post #12
post #11

Earlier quoted context omitted.

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? :)

It would seem to me the most significant challenge would be having functional data structures in C++, that would be a non-trivial effort I would think. Even if you were to use other libraries that experiment with this. Without those, the language just doesn’t make any sense.

My Park language does this https://github.com/toymachine/park-lang Currently the syntax is mostly JS but the semantics is all clojure. I recreated the map and vector datatypes in c++ by adapting clojures Java code. it needs a GC though which is another big part of the implemention of Park

Re: Joker: A small interpreted dialect of Clojure written in Go

#22
post #16
post #3

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.

What would be the advantage over other Lisps if you won't be able to leverage JVM ecosystem?

Some people like Clojure's data structures, which add a couple of things to lists. Also, there's ClojureScript, which is huge. And, ideas such as software transactional memory.

Re: Joker: A small interpreted dialect of Clojure written in Go

#23
post #20
post #11

Earlier quoted context omitted.

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? :)

I think recreating Clojure point by point is not optimal. There is some middle ground between full on Clojure and the straightjacket of the STL datastructures. - Clojure is kinda difficult to reason about performance wise. The lazyness.. some weird corner cases (like how `(first ..)` is slower than `(nth .. 0)` - The STL is very strict on the "zero cost abstraction" front. Maybe something like Immer but with some syn…

You see, I'd like to write more of my software in Clojure (or any functionally inclined Lisp). If there was a really good interop story with a non-gc:d native lang I could do more of it.

Clojure is a hosted language, so hosting it on C++ (or Rust etc.) would be sweet for me personally. Also, I like compiler projects.

Re: Joker: A small interpreted dialect of Clojure written in Go

#24
post #3

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.

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?)

What C tricks are used? I'd be fascinated to know some details.

Re: Joker: A small interpreted dialect of Clojure written in Go

#25
post #4

Earlier quoted context omitted.

Can do that with Graal these days: https://github.com/BrunoBonacci/graalvm-clojure/blob/master/...

I explored this briefly but it ended up taking about 25 seconds to compile hello-world in Clojure. That struck me as causing a lot of pain to develop for. That, combined with how you'd lose access to a lot of the java library ecosystem, makes it less appealing to me to develop on.

True, but you don't develop that way using graal. You develop java apps the usual way (eclipse, emacs/vim/maven, whatever) and create a fat jar (or uberjar). When you make sure the application is working, compile it with graal, creating a static binary.

Clojure cycle is even faster because you keep REPL open and evaluate code directly while application is running. After that, you build uberjar, then compile it with graal.

Re: Joker: A small interpreted dialect of Clojure written in Go

#26
post #15
post #2

This would go really well with https://cyclone.thelanguage.org/ .

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.

What made you give up on rust?

Re: Joker: A small interpreted dialect of Clojure written in Go

#27
post #23
post #20

Earlier quoted context omitted.

I think recreating Clojure point by point is not optimal. There is some middle ground between full on Clojure and the straightjacket of the STL datastructures. - Clojure is kinda difficult to reason about performance wise. The lazyness.. some weird corner cases (like how `(first ..)` is slower than `(nth .. 0)` - The STL is very strict on the "zero cost abstraction" front. Maybe something like Immer but with some syn…

You see, I'd like to write more of my software in Clojure (or any functionally inclined Lisp). If there was a really good interop story with a non-gc:d native lang I could do more of it. Clojure is a hosted language, so hosting it on C++ (or Rust etc.) would be sweet for me personally. Also, I like compiler projects.

Check out https://github.com/carp-lang/Carp

From the readme:

> The key features of Carp are the following:

> - Automatic and deterministic memory management (no garbage collector or VM)

> - Inferred static types for great speed and reliability

> - Ownership tracking enables a functional programming style while still using mutation of cache-friendly data structures under the hood

> - No hidden performance penalties – allocation and copying are explicit

> - Straightforward integration with existing C code

> - Lisp macros, compile time scripting and a helpful REPL

Re: Joker: A small interpreted dialect of Clojure written in Go

#28
post #25

Earlier quoted context omitted.

I explored this briefly but it ended up taking about 25 seconds to compile hello-world in Clojure. That struck me as causing a lot of pain to develop for. That, combined with how you'd lose access to a lot of the java library ecosystem, makes it less appealing to me to develop on.

True, but you don't develop that way using graal. You develop java apps the usual way (eclipse, emacs/vim/maven, whatever) and create a fat jar (or uberjar). When you make sure the application is working, compile it with graal, creating a static binary. Clojure cycle is even faster because you keep REPL open and evaluate code directly while application is running. After that, you build uberjar, then compile it with g…

Would there not be a risk that you may get something working nicely in openjdk and then you go to do a native compilation, and it turns out that it doesn't work due to some new method call which uses reflection or something?

Re: Joker: A small interpreted dialect of Clojure written in Go

#29
post #15

Earlier quoted context omitted.

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.

What made you give up on rust?

For me, it was "no need". I liked everything I saw. I just had no need to write Rust.

Re: Joker: A small interpreted dialect of Clojure written in Go

#30
post #6

Earlier quoted context omitted.

Have you tried Babashka? https://github.com/babashka/babashka

babashka also has a performance non-goal

That's true, but in my poor man tests, Babashka was in the ballpark of Python for me.
Post reply on HN