Replace str-render/instance-check set! chains with registries
jolt-str-render-one and instance-check were each extended by a chain of set!-wrapping closures spread across ~10 and ~5 host files, so the real behavior of either was scattered and load-order-dependent. Give each a registry the base file owns: converters.ss/records-interop.ss define the registry plus a register-* helper, and each extending file registers one arm instead of capturing %prev and set!-ing the global. str-render arms are type-disjoint; instance-check arms run newest-first (the old outermost-wins order) and may return 'pass to defer. The string-token -> symbol normalization the natives-array arm did for every inner arm moves to the dispatcher head; array tokens stay strings for that arm to decide. jolt-ogib.14. Runtime-only shims, no re-mint.
This commit is contained in:
parent
bc16513afd
commit
e434356590
14 changed files with 79 additions and 64 deletions
|
|
@ -410,14 +410,11 @@
|
|||
;; jolt exception values (ex-info + host-constructed throwables) are ex-info-shaped
|
||||
;; maps tagged :jolt/type :jolt/ex-info; (class …)/instance? read the JVM class off
|
||||
;; the optional :jolt/class key, defaulting to clojure.lang.ExceptionInfo.
|
||||
(define %r-str-render-one jolt-str-render-one)
|
||||
(set! jolt-str-render-one
|
||||
(register-str-render! jrec?
|
||||
(lambda (v)
|
||||
(if (jrec? v)
|
||||
(let ((f (find-protocol-method (jrec-tag v) "Object" "toString")))
|
||||
(if f (jolt-invoke f v)
|
||||
(let ((s (jrec-pr v))) (substring s 1 (string-length s)))))
|
||||
(%r-str-render-one v))))
|
||||
(let ((f (find-protocol-method (jrec-tag v) "Object" "toString")))
|
||||
(if f (jolt-invoke f v)
|
||||
(let ((s (jrec-pr v))) (substring s 1 (string-length s)))))))
|
||||
|
||||
;; `type` lives in natives-meta.ss: it needs jolt-meta for the :type
|
||||
;; override and a total value->taxonomy mapping, so it sits with meta — a record
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue