Welcome! Please see the About page for a little more info on how this works.

0 votes
in Errors by
Some core function names are reported in error messages with an odd munging suffix.

For example, when passing the wrong number of arguments to {{inc}}, {{assoc}}, and {{dissoc}}, each error message reports the function name differently:


clj -Srepro -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.10.0-beta4"}}}'



user=> (inc)
Syntax error compiling inc at (1:1).
Wrong number of args (0) passed to: clojure.core/inc--inliner--5436
user=> (assoc)
Evaluation error (ArityException) at clojure.lang.AFn.throwArity (AFn.java:429).
Wrong number of args (0) passed to: clojure.core/assoc--5316
user=> (dissoc)
Evaluation error (ArityException) at clojure.lang.AFn.throwArity (AFn.java:429).
Wrong number of args (0) passed to: clojure.core/dissoc


From the user's point of view, this behaviour is unmotivated and confusing. Perhaps such names should be further demunged and printed without the suffix.

2 Answers

0 votes
by

Comment made by: alexmiller

The first one here is an inlined function and happens during compilation, so is a little different than the others. Because it's inlined, it's not spec-able. The name parts there are generated within the compiler as well. This one might be fixable based on the regularity of the name construction, although I don't see it as a particularly high priority.

The latter two actually will be a bit different once we apply CLJ-2420:

user=> (assoc) Execution error (ArityException) at user$eval154/invokeStatic (REPL:1). Wrong number of args (0) passed to: clojure.core/assoc--5406 user=> (dissoc) Execution error (ArityException) at user$eval156/invokeStatic (REPL:1). Wrong number of args (0) passed to: clojure.core/dissoc

Changes here are actually eliding all the internal frames and reporting the top user frame now (here, it happens to be in the REPL invocation, but if it was in a user namespace, you'd see that instead).

I guess in both cases, the numbers you're seeing are a standard technique used throughout Clojure so the question might be whether it's possible to address this in a systematic way. Functions don't inherently carry their unmunged name right now, so demunging from class name is never going to be a foolproof mechanism.

Worth thinking about how to do this better, but not something I expect to look at soon.

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-2422 (reported by glts)
...