reader: feature set #{:jolt :default}, clause-order matching (RFC 0002)

jolt no longer satisfies :clj in reader conditionals. The shortcut was a
measured net liability: :clj branches carry JVM interop and JVM-specific
test expectations jolt fails, and they shadowed :default branches jolt
passes. A/B over the suite: clj,default = 4967 assertions / 4324 pass / 119
errors; jolt,default = 5069 / 4470 / 81 (+146 pass, -38 errors, +8 clean
files). Baselines raised to 4470/86.

Matching is now by CLAUSE order like Clojure — the first clause whose key is
in the feature set wins (#?(:default 5 :clj 6) is 5 everywhere); the old code
scanned for :clj first, then :default, regardless of position.

Foreign clj-targeted libraries are a property of the LOADING CONTEXT, not the
platform: reader-features-set! opts a load into a compatibility set, and the
SCI bootstrap/runtime tests load SCI under ["jolt" "clj" "default"] (its
.cljc selects implementations via :clj with no :jolt branches).
JOLT_FEATURES remains the process-wide override.

RFC 0002 records the decision with the measured data; spec 02-reader S18 is
now normative (clause order, documented feature set, per-context override).
Reader tests updated to the portable set + an opt-in round-trip.
This commit is contained in:
Yogthos 2026-06-10 11:40:06 -04:00
parent 2224e40afc
commit fdfd086df6
8 changed files with 164 additions and 33 deletions

View file

@ -45,8 +45,14 @@
["anon fn %&" "[2 3]" "(#(vec %&) 2 3)"]
["discard #_" "[1 3]" "[1 #_2 3]"]
["regex literal" "true" "(= \"abc\" (re-find #\"abc\" \"xabcx\"))"]
["reader conditional" "1" "#?(:clj 1 :cljs 2 :default 3)"]
["reader cond splice" "[1 2 3]" "[#?@(:clj [1 2 3] :cljs [4 5])]"]
# Feature set is #{:jolt :default} (spec 02-reader S18; RFC 0002) — :clj
# branches are NOT taken; matching is by clause order.
["reader conditional" "3" "#?(:clj 1 :cljs 2 :default 3)"]
["reader cond :jolt" "4" "#?(:clj 1 :jolt 4 :default 3)"]
["reader cond clause order" "5" "#?(:default 5 :jolt 6)"]
["reader cond no match" "[]" "[#?(:clj 1 :cljs 2)]"]
["reader cond splice" "[1 2 3]" "[#?@(:jolt [1 2 3] :cljs [4 5])]"]
["reader cond splice no match" "[]" "[#?@(:clj [1 2 3] :cljs [4 5])]"]
["inst literal reads" "true" "(some? #inst \"2020-01-01T00:00:00Z\")"]
["uuid literal" "\"550e8400-e29b-41d4-a716-446655440000\"" "(str #uuid \"550e8400-e29b-41d4-a716-446655440000\")"]
["tagged literal var" "true" "(var? #'+)"]