Protocol/interop fixes to run metosin/malli

Bringing up malli (schema validation) surfaced a batch of protocol and host-interop
gaps. m/validate now works across the schema vocabulary (predicates, :map incl.
nested/optional, :vector, :tuple, :enum, :maybe, :and, bounded int/string).

- extend-type and reify now accept MULTIPLE protocols in one form (each bare
  symbol switches the current protocol). reify records every protocol it
  implements, so instance?/satisfies? recognise all of them.
- Protocol method params support destructuring: reify/extend-type/deftype/
  defrecord emit (fn ...) (which desugars patterns) instead of raw fn*.
- instance? of a PROTOCOL works like satisfies? for reify/record instances,
  matching short names across qualified/bare protocol references.
- @x reads as the qualified clojure.core/deref, so it still derefs where a ns
  excludes and rebinds deref (malli does). Updated reader-test + the reader
  spec/grammar (S11, deref rule).
- Java collection interop on jolt collections: .nth/.count/.valAt/.get/.seq/
  .containsKey route to the clojure.core equivalent (1-arg and 0-arg paths).
- java.util.HashMap capacity/load-factor constructors + .putAll.
- A class used as a value resolves to its instances' type, so Pattern -> the
  regex type (malli keys class-schemas by it).
- Shims for malli's load path: LazilyPersistentVector/createOwning and
  PersistentArrayMap/createWithCheck statics.

m/explain not yet working (jolt-fjb1). Full gate green.
This commit is contained in:
Yogthos 2026-06-14 22:06:12 -04:00
parent d1f73f1740
commit 5a1532167c
8 changed files with 130 additions and 28 deletions

View file

@ -80,7 +80,9 @@
"unquote")
(assert (deep= @[(sym "unquote-splicing") (sym "x")] (parse-string "~@x"))
"unquote-splicing")
(assert (deep= @[(sym "deref") (sym "x")] (parse-string "@x"))
# @x reads as the QUALIFIED clojure.core/deref (like Clojure) so it derefs even
# where a ns excludes/rebinds `deref` (e.g. malli).
(assert (deep= @[(sym "clojure.core/deref") (sym "x")] (parse-string "@x"))
"deref shorthand")
# Metadata: a keyword/symbol/string hint on a symbol attaches to the symbol's