liveBook · Manning

Demunge

As explained in Clojure: The Essential Reference

demunge is a Clojure function that translates munged Java-style names back into readable Clojure names.

demunge translates munged Java-style names back into readable Clojure names. It is provided by clojure.repl and is mainly useful when inspecting stack traces at the REPL. section 22.3

Clojure names can contain characters that Java package and class names cannot, so munging provides an implicit translation between the conventions. demunge reverses that translation; stack-element-str uses the same cleanup for readable stack-trace entries. section 22.3

Readable names from munged output

(require '[clojure.repl :refer [demunge]]) (defn my-funct! []) (str my-funct!) ;; "my_namespace$my_funct_BANG_@621ada4f" (demunge (str my-funct!)) ;; "my-namespace/my-funct!@4e212104" section 22.3

Stack-trace cleanup

Given a stack-trace element containing `my_namespace$my_funct_BANG_`, applying `stack-element-str` produces `my-namespace/my-funct! (form-init4179141376169992155.clj:1)`. Use demunge directly when only the name requires translation. section 22.3

How Clojure: The Essential Reference covers it

How deep it goes
Explains the naming translation and demonstrates direct and stack-trace usage without detailing the encoding algorithm.
Examples
Uses a munged function name and a formatted stack-trace element as concrete demonstrations.
What it assumes
Assumes familiarity with Clojure names, namespaces, functions, and basic stack-trace inspection.
What you can do after
Apply it via clojure.repl to decode munged names while diagnosing or reading Clojure stack traces.
How it connects
Connects demunge with munge, stack-element-str, stack traces, Clojure namespaces, and Java naming conventions.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Clojure: The Essential Reference. The section links point to the parts of the book it draws on.