Chez Phase 2 (inc L): var def-time metadata (jolt-zikh)

Capture a def's reader metadata on the Chez var. The :def emit now lowers a def
with non-empty metadata to def-var-with-meta!, which stores the user meta
(^:private / ^Type tag / docstring -> {:doc}) in an eq side-table keyed by the
var-cell. jolt-meta of a var-cell merges that onto {:ns :name} derived from the
cell, so every var reports {:ns :name} like Clojure with the def-time meta
layered on. (^{:map} metadata on a def name stays uncompilable for the compiler
generally — analyzer rejects it, the Janet back end punts to its interpreter,
which Chez lacks — so it's out of subset, not a meta-capture gap.)

Added natives-meta.ss to the prelude-cache fingerprint. Prelude parity
1969 -> 1972, 0 new divergences; the three var-metadata allowlist entries
(^:private / ^Type tag / docstring) dropped. New focused gate
test/chez/_var_meta.janet.
This commit is contained in:
Yogthos 2026-06-18 17:13:46 -04:00
parent 32e2d8bd58
commit 737288bff5
6 changed files with 87 additions and 11 deletions

View file

@ -69,14 +69,9 @@
"defmethod overrides a record, top level" true
"defmethod fires nested in a map" true
"defmethod fires through prn" true
"methods table inspectable" true
# Phase 2 inc I (jolt-n7rz) made (var x)/#'x emit + the static var ops run; a
# var's def-time metadata (^:private / ^Type tag / docstring) isn't captured on
# the Chez var-cell yet, so (meta (var v)) is nil — var-metadata capture is a
# later increment.
"^:private on var" true
"^Type tag on var" true
"(def name doc val) doc" true})
# var def-time metadata (^:private / ^Type tag / docstring) is now captured on
# the Chez var-cell (jolt-zikh), so those three cases pass.
"methods table inspectable" true})
(def ctx (d/make-ctx))
@ -190,8 +185,11 @@
# jolt-yxqm (namespace value model — find-ns/ns-name/all-ns/resolve/ns-publics/
# in-ns/*ns* over the var-table + a jns ns value; native-op var cells so
# (resolve '+) is a var; *ns* bound to the user ns) 1969.
# jolt-zikh (var def-time metadata — :def emit passes reader meta to
# def-var-with-meta!; (meta (var v)) is {:ns :name} + ^:private/^Type tag/
# docstring) 1972.
# Strided runs scale down.
(def base-floor (scan-number (or (os/getenv "JOLT_CHEZ_PRELUDE_FLOOR") "1969")))
(def base-floor (scan-number (or (os/getenv "JOLT_CHEZ_PRELUDE_FLOOR") "1972")))
(def floor (if (os/getenv "JOLT_CORPUS_LIMIT") 0 base-floor))
(when (or (> (length diverged) 0) (< pass floor))
(printf "REGRESSION: pass %d < floor %d or %d new divergence(s)" pass floor (length diverged)))