core: *ns* — the current-namespace dynamic var

*ns* is interned in clojure.core holding the current NAMESPACE OBJECT, kept
in sync by ctx-set-current-ns through a var table cached on the env (one
table put on the hot path; core-bench A/B neutral). A thread binding
(binding [*ns* ...]) shadows the root through var-get as usual. in-ns now
returns the namespace object (Clojure); str renders a namespace as its name
and pr-str as #namespace[name]. The ns-designator helper accepts namespace
objects (they are tagged STRUCTS — the old table?-based check never matched
them), so (ns-aliases *ns*) / (ns-unalias *ns* 'a) work — SCI and the jank
syntax-quote corpus use exactly that shape.

Known divergence (documented): inside an interpreted fn, *ns* reflects the
fn's defining ns (jolt's resolution model rebinds current-ns per call);
top-level and load-time reads match Clojure.

Gate green (conformance 326x3, suite 4572 >= 4540, all batteries,
specs+unit +8 *ns* rows); bench neutral.
This commit is contained in:
Yogthos 2026-06-10 13:05:15 -04:00
parent 4f872fce94
commit 817495dd51
5 changed files with 46 additions and 9 deletions

View file

@ -3,16 +3,16 @@
Generated 2026-06-10 by `tools/spec_coverage.py` — do not edit by hand.
Surface: **694** clojure.core vars (ClojureDocs export; 648 with
community examples). jolt interns 552 of them.
community examples). jolt interns 553 of them.
| Status | Count | Meaning |
|---|---|---|
| implemented+tested | 415 | in jolt and exercised by spec/conformance |
| implemented-untested | 137 | in jolt, no direct test — spec entries will add them |
| implemented-untested | 138 | in jolt, no direct test — spec entries will add them |
| resolvable-not-interned | 2 | works in code but invisible to ns introspection (conformance finding) |
| missing-portable | 10 | portable semantics, jolt lacks it — implementation gap |
| special-form | 15 | specified in §3, not a library var |
| dynamic-var | 31 | classification needed: portable default vs host-dependent |
| dynamic-var | 30 | classification needed: portable default vs host-dependent |
| agents-taps | 22 | out of scope pending concurrency design note |
| stm-refs | 11 | out of scope pending concurrency design note |
| jvm-specific | 53 | catalogued, not specified |
@ -47,7 +47,7 @@ UNVERIFIED field; that column will be added as entries land.
| `*fn-loader*` | dynamic-var | |
| `*in*` | dynamic-var | |
| `*math-context*` | dynamic-var | |
| `*ns*` | dynamic-var | ✓ |
| `*ns*` | implemented-untested | ✓ |
| `*out*` | dynamic-var | ✓ |
| `*print-dup*` | dynamic-var | ✓ |
| `*print-length*` | dynamic-var | ✓ |