Chez Phase 2 (inc K): namespace value model (jolt-yxqm)
Reimplement the ctx-coupled seed ns natives over the rt.ss var-table, since Chez has no ctx. host/chez/ns.ss adds a jns namespace value + a registry and binds find-ns/the-ns/create-ns/in-ns/all-ns/ns-publics/ns-map/ns-interns/ ns-aliases/resolve/find-var/ns-unmap/*ns* into clojure.core. The resolve friction: native-ops (+, map, …) are inlined at emit so they have no var-cell, and (resolve '+) was nil — diverging from Clojure where it's a var. Added a defined? flag to the var-cell record (set by def-var!/declare-var!, left false on a lazily-materialised forward ref) and def-var!'d every native-op name to its value-position proc, so resolve returns the cell iff genuinely defined. ns-unmap clears the flag. resolve never interns an empty cell (var-cell-lookup is non-creating). ns-name is overridden natively in post-prelude (the overlay reads (get ns :name), nil on a jns record); the printers render a namespace as its name. *ns* binds to the user ns; in-ns re-binds it. use/require cross-ns switching stays deferred to Phase 3 (the analyzer bakes a def's target ns at compile time). Prelude parity 1951 -> 1969, 0 new divergences; four now-passing allowlist entries dropped (ns *ns* cases + str-of-a-var). New focused gate test/chez/ _ns.janet (19 cases, expectations from the JVM-canonical build/jolt).
This commit is contained in:
parent
eb26ad0401
commit
32e2d8bd58
6 changed files with 247 additions and 10 deletions
|
|
@ -28,3 +28,6 @@
|
|||
(def-var! "clojure.core" "random-uuid" jolt-random-uuid)
|
||||
(def-var! "clojure.core" "parse-uuid" jolt-parse-uuid)
|
||||
(def-var! "clojure.core" "tagged-literal?" jolt-tagged-literal-pred?)
|
||||
;; ns-name: the overlay reads (get ns :name) — nil on a jns namespace record.
|
||||
;; Native version (defined in ns.ss) returns the namespace's name symbol.
|
||||
(def-var! "clojure.core" "ns-name" jolt-ns-name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue