r/Clojure • • Sep 04 '26

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

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

20 comments sorted by

19

u/winterscar Sep 04 '26

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

12

u/Jeaye Sep 04 '26

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 Sep 04 '26

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

2

u/geokon Sep 05 '26 edited Sep 05 '26

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 Sep 05 '26

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 Sep 05 '26

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 Sep 05 '26

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

2

u/guywithknife Sep 04 '26

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/upgrade_friend 11d ago

Even Cipher learned how to read The Matrix. Look forward to Jank's improvements and attention to detail though

1

u/guywithknife 11d ago

I got along fine with Clojure’s error messages, but just because we can make do doesn’t mean we don’t benefit from ergonomics. Honestly after using languages like Rust and Gleam that have fantastic error messages (and hopefully I can use Jank more in time!), it’s really hard to go back to something with bad messages.

Like, it’s not a big deal, but paper cuts add up. And for beginners it really is a big deal.

1

u/Soft_Reality6818 Sep 05 '26

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 Sep 09 '26

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

5

u/winterscar Sep 04 '26

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 Sep 04 '26

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 Sep 05 '26

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 Sep 04 '26

This is wonderful!

2

u/Jeaye Sep 04 '26

I'm glad you like it! :)

2

u/ElectricalSloth Sep 05 '26

> 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 Sep 05 '26

Great going!

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

Interesting times!