clojure-europe 2026-06-04

good morning β˜€οΈ

definitely up there in terms of confusing clojure error messages

class my.ns$some_var cannot be cast to class clojure.lang.IFn$LLO

πŸ€” 1

my (potentially wrong) understanding is that I had a var with primitive tags on the arguments, which I changed and re-evaluated, but I did not re-evaluate the place where it's being called

I really appreciate the work Sean has been doing on https://clojurians.slack.com/archives/C06MAR553/p1779243752566019

πŸ‘πŸ» 1

Yeah I need to make some time to try that out, maybe we'll add it as a default to launchpad

I look forward to any and all feedback on rephrase...

here's a repro @seancorfield, unless I'm holding it wrong it doesn't seem like rephrase does anything with this one yet

(defn foo ^long [^long x]
  x)

(defn bar []
  (+ (foo 3) (foo 4)))

(bar)

(defn foo [x] x)

(bar) ;;=> throws: class repl_sessions.rephrase_test$foo cannot be cast to class  clojure.lang.IFn$LL

I get "Expected a function$LL, but was given user$foo, at user/bar (REPL:1) - runtime error (unexpected type)." You added wrap-rephrase as nREPL middleware when starting your REPL?

(which can definitely be improved, but does show it working)

I did, although it may be interacting with some custom middleware we have...

And how are you eval'ing the code? I did it in a plain nREPL client but it also works for me, eval'ing forms via VS Code/Calva.

from emacs/cider. don't worry about it, it's almost certainly something weird in my setup

If it helps, here's how I construct my list of middleware: https://github.com/seancorfield/dot-clojure/blob/develop/src/org/corfield/dev/repl.clj#L164-L170 nREPL does a topo sort on metadata (requires/expects) so order should not matter (in theory).

@plexus Would you mind filing an Ask Clojure about this error? It would help the dev team to have specific examples of bad errors. This error seems especially lousy!

@neumann there you go https://ask.clojure.org/index.php/15124/changing-type-tags-can-lead-to-cryptic-errors not a question though so doesn't feel right to post it there, but since you asked.

It's definitely appropriate to post there. In fact, @alexmiller suggested it to me. If it makes you feel better, the implied question is, "Can you please fix this?" πŸ™‚

Alex Miller (Clojure team) 2026-06-05T18:45:38.893249Z

I will eventually get around to replying better there, but this error doesn't really surprise me, good example of the general problem of "repl state contains only partially recompiled code". also a good example of a case that more defensive code could detect and either error better or literally handle automatically by finding the primitive interface no longer exists and choosing the non-primitive invoke (which still exists). However, the tradeoff is that every call-site is way more code. I think we'd all take the tradeoff of better errors at repl/dev time, but most would not like it at prod time where there are real costs (what if all classes were 10-20% bigger and thus harder for the jit to optimize?). We've been thinking about dev vs prod compilation modes for at least a decade as it would let us take both sides. I spent some time working on it within the last year, still an active idea! It's great to have more examples like this.

πŸ™ŒπŸ» 1

Just to be clear, @alexmiller, your comment "this error doesn't really surprise me". I'm assuming you mean that as someone who understand the compiler internals quite well. As a user, it is quite surprising, so if I can speak for you, I'd say that you're not negating the validity of that experience. I'd love to see a dev mode that would provide high-quality error messages, even if the code was less efficient. I might even leave that flag on for code that wasn't performance sensitive.

Alex Miller (Clojure team) 2026-06-05T20:11:06.891309Z

yes, I meant to me, not to user, sorry if that was unclear. Agree this is inscrutable to user

good mornings!

Good morning!

πŸ‘‹ 3

Hearty good morning this fine Thursday

❀️ 1

I'm more proficient at stringing than playing 😬

I'm sure you're more proficient at playing than I am πŸ™‚

πŸ€·πŸ»β€β™‚οΈ

good morning

Good str/trim morning

🎸 1

That guitar looks gorgeous!

πŸ™πŸΌ 1

It's better looking than I am at playing

I don't about that but I know it’s not better looking than you πŸ˜‰

Ha, you're too kind 😊