Phase 11: Fix pre-existing failures — 316/317 passing

- types.janet: ns? now accepts both structs and tables
  (defensive for namespace-like tables created via @{...})
- core.janet: wire comment macro into core-bindings
  (was in core-macro-names but missing from core-bindings)
- sci/lang_stubs.clj: minimal SCI type stubs for bootstrap
  (IBox, HasName, IVar, DynVar protocols, SciUnbound/Var/Namespace deftypes)
- test-load-sci.janet: load stubs before SCI source files,
  removed broken preprocessor

Before: 315 ok, 2 fail (SciVar + array/buffer)
After:  316 ok, 1 fail (only deftype in lang.cljc remains)

The remaining failure is lang.cljc's SciVar deftype with #?@ inserts
for JVM/CLJS-specific protocol implementations — a known limitation
for Phase 15 (SCI bootstrap).
This commit is contained in:
Yogthos 2026-06-03 12:30:11 -04:00
parent 1c1100e2f0
commit 09b4e3e1bd
10 changed files with 179 additions and 69 deletions

View file

@ -0,0 +1,32 @@
; Minimal SCI type stubs for Jolt bootstrap
; Provides the deftype definitions that SCI's Clojure source references
; before the full SCI runtime is loaded.
; Protocol stubs for SCI's type system
(defprotocol IBox (setVal [this v]) (getVal [this]))
(defprotocol HasName (getName [this]))
(defprotocol IVar (bindRoot [this v]) (getRawRoot [this]) (toSymbol [this])
(isMacro [this]) (setThreadBound [this v]) (unbind [this]) (hasRoot [this]))
(defprotocol DynVar (dynamic? [this]))
(defprotocol IReified (getInterfaces [this]) (getMethods [this])
(getProtocols [this]) (getFields [this]))
; Unbound sentinel for vars
(deftype SciUnbound [the-var])
; Core SCI types — keep minimal for bootstrap
(deftype Namespace [name mappings aliases imports])
(deftype Var [root name meta macro dynamic ns])
; Store stub (sci.ctx-store provides a global context atom)
(def ctx-store (atom nil))
; Macro helpers from sci.impl.macros
(defn deftime [& body] nil)
(defn usetime [& body] (eval (first body)))
(defmacro ? [& args]
(if (contains? &env (quote &env))
(let [form (first args)]
(if (= :clj (first form))
(second form)
(if (= :cljs (first form)) nil)))))

View file

@ -1334,6 +1334,7 @@
"IllegalStateException" core-IllegalStateException
"definterface" core-definterface
"defrecord" core-defrecord
"comment" core-comment
"resolve" core-resolve
"update" core-update
"copy-core-var" core-copy-core-var

View file

@ -219,7 +219,7 @@
(defn ns?
"Check if x is a Jolt Namespace."
[x]
(and (struct? x) (= :jolt/namespace (x :jolt/type))))
(and (or (struct? x) (table? x)) (= :jolt/namespace (x :jolt/type))))
(defn ns-name
"Return the name symbol of a namespace."