core: cold tagged-type printing migrates to print-method defmethods

The first per-type migration print-method unlocked: uuid, regex, transient,
and channel rendering move from host pr-render branches to io-tier
defmethods (exact same output). The renderer's tagged fallthrough now
dispatches ANY remaining :jolt/* value through the print-method hook before
the raw pairs view — so every tagged type is user-overridable, atoms
included ((defmethod print-method :jolt/atom ...) fires nested), and future
per-type migrations are pure overlay additions.

Hot types (numbers, strings, symbols, collections) stay native, and inst/
namespace/var stay host for now — their formatters (rfc3339, display names)
live there anyway. A transient's :kind is read with jolt.host/ref-get: get
on a transient is the dispatched collection lookup (same trap as sorted
colls).

Before the hook is wired (init-time error messages) tagged values fall
through to the pairs view — bootstrap rendering only.
This commit is contained in:
Yogthos 2026-06-11 18:35:21 -04:00
parent 8efdd9956d
commit af3e49a89c
3 changed files with 47 additions and 6 deletions

View file

@ -156,3 +156,24 @@
(if (keyword? t) t (type x)))))
(defmethod print-dup :default [o w] (print-method o w))
;; Cold tagged-type renderings, migrated from the host renderer (the hot
;; types — numbers, strings, symbols, collections — stay native). Each is the
;; exact output the host branch produced.
(defmethod print-method :jolt/uuid [u w]
(.write w (str "#uuid \"" (get u :str) "\""))
nil)
(defmethod print-method :jolt/regex [re w]
(.write w (str "#\"" (get re :source) "\""))
nil)
;; a transient's get IS the dispatched collection lookup — read the wrapper's
;; own :kind field with the host accessor (same trap as sorted colls).
(defmethod print-method :jolt/transient [t w]
(.write w (str "#<transient " (name (jolt.host/ref-get t :kind)) ">"))
nil)
(defmethod print-method :jolt/chan [c w]
(.write w "#<channel>")
nil)