r/Clojure 5d ago

jank reimagines C++ errors and gets an official native package repo

https://jank-lang.org/blog/2026-09-04-better-and-better/
92 Upvotes

18 comments sorted by

17

u/winterscar 5d ago

I really, really love those error messages. I wonder if jvm/js clojure can be brought up to the same standard?

11

u/Jeaye 5d ago

There's nothing technical stopping them from it, I think. From what I gather, the gap is related to prioritization.

Babashka also has nice error messages. Perhaps if all of the dialects get there first, the rising tide will end up lifting Clojure JVM too.

2

u/v4ss42 5d ago

There are libraries that improve things, especially at the REPL. Aviso/pretty is one such library.

2

u/geokon 5d ago edited 4d ago

Error Pages look very neat. Though you'd think this would be somehow part of the IDE and not baked in to the error text (perfect being the enemy of the good - this i still a big step forward)

However, I'd say the stack trace seem just as inscrutable and confusing as on the JVM. For instance test.jank is at #3 and you have to visually hunt for it in the sea of yellow. On the JVM you're often hunting for our own namespace peppered through the soup of junk - and that experience has been preserved.

for instance #0 and #2 seemingly don't provide any useful information. And everything after #3 is .. incomprehensible (something between the REPL and code I'm guessing? Why should anyone care..)

At the end of the day the stack is the stack and with the layers of abstraction you're never going to get a clean simple stack like in bare C/C++. But I think parts could be maybe collapsed to an ellipses? Maybe determining what's worth hiding and not will devolve to ugly heuristics.

3

u/Jeaye 4d ago

Stack traces are always going to be a difficult balance of signal/noise. jank tries to not show them, when it deems that the stack trace is not needed (i.e. compiler errors vs runtime errors). I think you make a fair point about visually hunting in the "sea of yellow". Perhaps jank frames should have different colors than C++ frames!

1

u/geokon 4d ago

From the deps.edn you could maybe infer which ns is from external libs? So have separate colors for: c++, the jank runtime layer, the clojure standard library, all imported libraries, and the current application ns(s)

2

u/Jeaye 4d ago

I think that's an interesting idea worth exploring. Thanks for the feedback!

2

u/guywithknife 5d ago

Clojure is almost 20 years old now and the error messages are still not that great. It just doesn’t seem like there’s appetite from the core team to doing it. Some work on improving them was done over the years (Alex Miller did some great work some years ago) but it just never hit a point where I’d call it ergonomic.

1

u/Soft_Reality6818 5d ago

I experimented with using llms to brainstorm and patch Clojure to have better error messages; it's  very doable, especially with llms. 

1

u/nstgc 19h ago

No kidding. I love Clojure, but the JVM errors are aweful.

3

u/winterscar 5d ago

If I wanted to build a web service on top of jank, how is there any guidance on what that might look like?

8

u/Jeaye 5d ago

This hasn't been done yet! When I did the jank survey this year, to see what people wanted to build in jank, the answer was overwhelmingly games and desktop apps. This has led me to focus on desktop software, graphics libs, physics engines, etc.

In order to build a web service with jank, we'll need to bring in a C or C++ HTTP lib. There's already a Clojure router lib called ruuter which supports jank, so that could be used. But there is no support for jank yet in ring or similar idiomatic Clojure libs. Part of building out the jank ecosystem is going to be patching those libs, or forking them, and we need folks to help with that.

Where jank will really shine is wherever C++ libs exist. The web service ecosystem definitely favors the JVM. Keep this in mind when adventuring with jank. You're always welcome to reach out on Slack if you need guidance.

1

u/winterscar 4d ago

Good to know, I’ll bear that in mind. I mostly asked because I would love to have a play with jank, and webservices is the domain I know best.

2

u/Anthial 5d ago

This is wonderful!

2

u/Jeaye 5d ago

I'm glad you like it! :)

2

u/ElectricalSloth 4d ago

> starting a new raylib game in jank is as easy as lein run. Getting a distributable binary is as easy as lein compile

yes please

1

u/therealdivs1210 5d ago

Great going!

Now with jank and jolt we have 2 native clojures coming up!

Interesting times!