feat: stub SCI host modules, fix require :as+:refer, +promoting ops/eduction
Push SCI loading much further: the giant clojure.core aggregation map in namespaces.cljc now resolves ALL its symbols (it previously failed on dozens). - host_stubs.clj: forward-decl no-op fns for SCI's host-layer modules (parser/read/load/macroexpand/resolve/proxy/reify) — Jolt supplies its own reader/loader, so these only need to resolve when the binding map is built. Stubs are non-nil fns so :refer re-interns them (a nil-valued var is dropped). - Load Jolt's clojure.string/set/walk/edn before namespaces.cljc. - Add real clojure.core: ==, print-str, eduction/->Eduction, seq-to-map-for-destructuring, split-lines, postwalk-demo/prewalk-demo, +'/-'/*'/inc'/dec' (Jolt doesn't overflow, so == non-quoted), proxy-super and friends (resolve-only, JVM-specific). Fix a real require bug: eval-require stopped at the first option, so [ns :as x :refer [...]] silently dropped the :refer. Now processes all options. SCI load: clojure.core map now builds; only two forms remain (a Var-protocol method on sci.lang.Var, and the clojure.repl namespace). conformance 218/218, features 78/78, jank 120.
This commit is contained in:
parent
dd51322ff1
commit
e52c445113
6 changed files with 125 additions and 10 deletions
|
|
@ -19,6 +19,12 @@
|
|||
|
||||
(load-stubs ctx "src/jolt/clojure/sci/lang_stubs.clj")
|
||||
(load-stubs ctx "src/jolt/clojure/sci/io_stubs.clj")
|
||||
(load-stubs ctx "src/jolt/clojure/sci/host_stubs.clj")
|
||||
|
||||
# namespaces.cljc copies vars out of Jolt's own clojure.string/set/walk/edn, so
|
||||
# make sure those are loaded before it runs.
|
||||
(each lib ["clojure.string" "clojure.set" "clojure.walk" "clojure.edn"]
|
||||
(protect (eval-form ctx @{} (first (parse-next (string "(require '[" lib "])"))))))
|
||||
|
||||
(defn load-file [ctx path]
|
||||
(var s (slurp path))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue