feat: map literals evaluate their values (fixes critical latent bug); expand SCI bootstrap to 14 files (ctx_store/deftype/records/core_protocols/hierarchies + sci.impl.io stub), 390/392 forms; fix multi-arity defmethod (builds fn*) and variadic macrofy; SCI test loaders tolerant of the 2 redundant clojure.core registration maps
This commit is contained in:
parent
7d490843e5
commit
1b37e56df4
8 changed files with 74 additions and 24 deletions
|
|
@ -276,6 +276,13 @@
|
|||
["alternation" "\"dog\"" "(re-find #\"cat|dog\" \"a dog cat\")"]
|
||||
["str/replace $1" "\"he[ll]o\"" "(do (require (quote [clojure.string :as s])) (s/replace \"hello\" #\"(l+)\" \"[$1]\"))"]
|
||||
["str/replace regex" "\"X-X\"" "(do (require (quote [clojure.string :as s])) (s/replace \"a-b\" #\"[a-z]\" \"X\"))"]
|
||||
|
||||
### ==== map literals evaluate their values ====
|
||||
["map literal expr" "{:a 3}" "{:a (+ 1 2)}"]
|
||||
["map literal var" "{:k 5}" "(let [x 5] {:k x})"]
|
||||
["map literal nested" "{:a {:b 2}}" "(let [y 2] {:a {:b y}})"]
|
||||
["map literal keyfn" "{:x 1}" "(let [k :x] {k 1})"]
|
||||
["map literal in fn" "6" "(do (defn mk [a b] {:sum (+ a b)}) (:sum (mk 2 4)))"]
|
||||
])
|
||||
|
||||
(var pass 0)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
(printf " Loaded %d stub forms\n" count))
|
||||
|
||||
(load-stubs ctx "src/jolt/clojure/sci/lang_stubs.clj")
|
||||
(load-stubs ctx "src/jolt/clojure/sci/io_stubs.clj")
|
||||
|
||||
(defn load-file [ctx path]
|
||||
(var s (slurp path))
|
||||
|
|
@ -55,6 +56,11 @@
|
|||
["impl/vars.cljc" nil]
|
||||
["lang.cljc" nil]
|
||||
["impl/utils.cljc" nil]
|
||||
["ctx_store.cljc" nil]
|
||||
["impl/deftype.cljc" nil]
|
||||
["impl/records.cljc" nil]
|
||||
["impl/core_protocols.cljc" nil]
|
||||
["impl/hierarchies.cljc" nil]
|
||||
["impl/namespaces.cljc" nil]
|
||||
["core.cljc" nil]
|
||||
])
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
(def [form rest] (parse-next s))
|
||||
(set s rest)
|
||||
(when (not (nil? form))
|
||||
(eval-form ctx @{} form))))
|
||||
(protect (eval-form ctx @{} form)))))
|
||||
|
||||
(defn- load-file [ctx path]
|
||||
(var s (slurp path))
|
||||
|
|
@ -17,7 +17,10 @@
|
|||
(def [form rest] (parse-next s))
|
||||
(set s rest)
|
||||
(when (not (nil? form))
|
||||
(eval-form ctx @{} form))))
|
||||
# Tolerant: SCI's clojure.core registration maps reference the full
|
||||
# clojure.core surface (redundant for Jolt's native core); skip forms
|
||||
# that don't resolve rather than aborting the bootstrap.
|
||||
(protect (eval-form ctx @{} form)))))
|
||||
|
||||
# Run from project root so paths resolve
|
||||
(def root (if (has-value? (dyn :syspath) 0) (first (dyn :syspath)) "."))
|
||||
|
|
@ -25,11 +28,14 @@
|
|||
(def ctx (init))
|
||||
|
||||
(load-stubs ctx (string root "/src/jolt/clojure/sci/lang_stubs.clj"))
|
||||
(load-stubs ctx (string root "/src/jolt/clojure/sci/io_stubs.clj"))
|
||||
|
||||
(def sci-base (string root "/vendor/sci/src/sci"))
|
||||
(each file ["impl/macros.cljc" "impl/protocols.cljc" "impl/types.cljc"
|
||||
"impl/unrestrict.cljc" "impl/vars.cljc" "lang.cljc"
|
||||
"impl/utils.cljc" "impl/namespaces.cljc" "core.cljc"]
|
||||
"impl/utils.cljc" "ctx_store.cljc" "impl/deftype.cljc"
|
||||
"impl/records.cljc" "impl/core_protocols.cljc" "impl/hierarchies.cljc"
|
||||
"impl/namespaces.cljc" "core.cljc"]
|
||||
(load-file ctx (string sci-base "/" file)))
|
||||
|
||||
# ── Verify sci.lang NS and Type ─────────────────────────────────
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue