Fork me on GitHub
#clojure
<
2021-10-30
>
West07:10:38

I was just in a shibuya.lisp event. This guy showed a really cool project he was working on. It shows the code context with Clojure stacktraces. I can imagine that this would make debugging a bit easier. https://github.com/athos/stacktracer

p-himik08:10:10

Is there a video or any other material accompanying the library?

athos08:10:03

Hi, I’m the author of the library 😃 Just added a demo image to the README.

🙏 1
p-himik08:10:52

Awesome, thanks!

👍 1
kwladyka08:10:20

is it stable already? (not beta)

kwladyka08:10:56

I know it is in the code but how are you doing “clojure” version?

athos09:10:06

It’s still a work in progress. Still needs some work before the release.

athos09:10:35

> how are you doing “clojure” version? Sorry, but I don’t get what you mean.

West09:10:48

Who knows, if this gets really good, maybe we can see it integrated into Clojure itself. I know I could’ve used this when just starting out.

Ben Sless10:10:57

Very cool project, thanks for sharing, and thank you athos for developing it

😉 2
athos11:10:05

If you overwrite clojure.main/repl-caught like (alter-var-root #'clojure.main/repl-caught (constantly st/pst-for)) in your user.clj, you can get this rich error info as the default error message on the REPL.

👍 1
schmee11:10:43

looks really cool, definitely giving this a try!

john14:10:46

Yeah, that's pretty awesome

lread15:10:19

Neat! The formatting reminds me a bit of how shadow-cljs reports compile-time issues (example https://shadow-cljs.github.io/docs/UsersGuide.html#infer-externs):

------ WARNING #1 --------------------------------------------------------------
 File: ~/project/src/demo/thing.cljs:23:3
--------------------------------------------------------------------------------
  21 |
  22 | (defn wrap-baz [x]
  23 |   (.baz x))
---------^----------------------------------------------------------------------
 Cannot infer target type in expression (. x baz)
--------------------------------------------------------------------------------

emccue15:10:24

@U0508956F what are the mechanics of this? curious if i can get an equivalent thing working for plain ol’ java

athos03:10:49

@U3JH98J4R It's not that hard for Clojure. Clojure source code is just a resource on the classpath. You can read it just as an ordinary resource file (That's what clojure.repl/source does internally). But, I think it would require more to do the same thing for Java. You might have to decompile the bytecode to support third-party libraries.

didibus17:10:47

This is really nice, probably a great way to improve errors, instead of fixing the message, just show the actual code fragments that threw the error

didibus17:10:10

Nice idea!

athos01:11:30

Thanks! Yeah, I started dogfooding the library at work last week, and it help me a lot already.