fix: pr-str/str of a var, and nREPL namespace switching

- core: pr-render/str-render now render a Jolt var as #'ns/name instead of
  falling through to the generic table printer, which recursed into the var's
  cyclic :meta/:ns refs and looped forever. Adds name-of/var-display helpers.
- jolt.nrepl: capture the post-eval namespace *after* running the form — jolt
  evaluates map-literal values right-to-left, so {:val (eval form) :ns (the-ns)}
  read the ns before in-ns ran, pinning every session to 'user'. Now in-ns/ns
  switches persist across evals. render-value dropped: pr-str handles vars.
- specs: var printing (strings-spec) and nREPL in-ns/ns-persistence + explicit
  :ns override (nrepl-test).
This commit is contained in:
Yogthos 2026-06-05 22:05:45 -04:00
parent 5b66cfaa97
commit d00c3cc117
4 changed files with 38 additions and 7 deletions

View file

@ -13,6 +13,11 @@
["string? true" "true" "(string? \"x\")"]
["pr-str vector" "\"[1 2 3]\"" "(pr-str [1 2 3])"]
["pr-str quotes str" "\"\\\"hi\\\"\"" "(pr-str \"hi\")"]
# a var's :meta/:ns refs are cyclic — pr-str/str render it as #'ns/name
# rather than recursing into (and looping on) the var's fields.
["pr-str of a var" "\"#'user/vv\"" "(pr-str (def vv 1))"]
["str of a var" "\"#'user/ww\"" "(str (def ww 2))"]
["pr-str of a defn" "\"#'user/gg\"" "(pr-str (defn gg [x] x))"]
["seq of string" "[\\a \\b]" "(seq \"ab\")"])
(defspec "clojure.string"