core: Stage 2 Task 2 tier 4a — compile require + in-ns
require/in-ns take quoted (already-evaluated) args, so they become ordinary ctx-capturing clojure.core fns (install-stateful-fns!): - require-impl (varargs over specs -> eval-require) / in-ns-impl, extracted from the eval-list special arms. - removed their eval-list match arms (they fall through to the function-call default, resolving the interned closures) and dropped them from host_iface special-names + loader stateful-head? + compiler uncompilable-heads. require+alias+refer and in-ns now compile + interpret as plain invokes. Tests: namespace-test uses bare make-ctx, so it now installs the stateful fns via a fresh-ctx helper (api/init does this automatically). fallback-zero moves require off must-punt and adds require/in-ns/defprotocol/extend-type/ reify/(var map) to must-compile (37 now); deftype takes require's must-punt slot. Gate green: conformance 267x3, fallback-zero 37/5, bootstrap-fixpoint stage1==2==3, self-host, staged-bootstrap, clojure-test-suite >=4034/67, features 78/78, deps-loader, all unit + spec (namespaces 24/24).
This commit is contained in:
parent
124cbf370a
commit
3709c868e6
6 changed files with 55 additions and 26 deletions
|
|
@ -42,13 +42,20 @@
|
|||
"(def answer 42)" "(map inc [1 2 3])" "(reduce + 0 [1 2 3])"
|
||||
"(get {:a 1} :a)" "(vec (range 5))"
|
||||
# set?/disj are plain fns now, not special forms (jolt-g3h)
|
||||
"(set? #{1 2})" "(disj #{1 2 3} 2)"])
|
||||
"(set? #{1 2})" "(disj #{1 2 3} 2)"
|
||||
# Stage 2 (jolt-eaa): stateful forms moved onto the compile path. (binding only
|
||||
# compiles over an INTERNED var; the built-in dynamic vars aren't interned yet,
|
||||
# so it's exercised end-to-end in the state spec instead.)
|
||||
"(require (quote [clojure.string :as s]))" "(in-ns (quote foo.bar))"
|
||||
"(defprotocol P (m [x]))" "(extend-type Long P (m [x] x))"
|
||||
"(reify P (m [this] 1))" "(var map)"])
|
||||
|
||||
# --- Intentional fallback (sanity sample): these SHOULD punt to the interpreter.
|
||||
# Not the frozen set (that's Task 2) — just a few to confirm the boundary holds
|
||||
# in the punt direction so the harness can't pass by compiling everything.
|
||||
# Shrinking as Stage 2 (jolt-eaa) moves stateful forms onto the compile path
|
||||
# (require/in-ns/protocols/binding now compile). The remaining frozen/uncompiled
|
||||
# set keeps the harness honest in the punt direction.
|
||||
(def must-punt
|
||||
["(ns foo.bar)" "(defmacro m [x] x)" "(require (quote [clojure.string]))"
|
||||
["(ns foo.bar)" "(defmacro m [x] x)" "(deftype T [a])"
|
||||
"(set! *warn-on-reflection* true)" "(letfn [(f [n] (g n)) (g [n] (f n))] (f 1))"])
|
||||
|
||||
(var fails @[])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue