core: close the compile-path gaps that broke uberscripting Selmer + config
Loading these libs via require worked (load-ns-source interprets, macros
expand lazily) but the same code inlined by uberscript routes through
eval-toplevel and compiled, surfacing four gaps:
- a ^{:map} metadata def name reads as (def (with-meta name m) v); the
analyzer died extracting the name (config.core's defonce env). It now
throws uncompilable so the interpreter, which handles it, takes over.
- declare was a no-op, so a compiled forward reference to a declared
name that collides with a janet root binding bound to the host fn
(selmer.parser's (declare parse) compiled to janet's 1-arg parse).
declare now expands to no-init defs, the interpreter interns them,
and the analyzer routes no-init def to the interpreter.
- class? was missing (selmer.util's exception macro calls it at
expansion time). Always false, like ratio? — no Class objects here.
- require of an unlocatable namespace silently left an empty ns behind,
deferring the failure to an unresolved symbol far from the cause. It
now throws like Clojure's FileNotFoundException. Namespaces entered
in-session count as loaded (Clojure puts them in *loaded-libs*), and
the SCI bootstrap opts out via :lenient-require? since its
clj-targeted requires can't all exist on this host.
This commit is contained in:
parent
c2511fee7e
commit
703a59d40b
10 changed files with 127 additions and 34 deletions
|
|
@ -73,6 +73,9 @@
|
|||
["do nested" "1" "(do (do (do (do 1))))"]
|
||||
["do returns last" "3" "(do 1 2 3)"]
|
||||
["def + deref var" "true" "(var? (def one 1))"]
|
||||
["def no init interns var" "true" "(var? (def no-init))"]
|
||||
["def no init keeps existing root" "7" "(do (def kept 7) (def kept) kept)"]
|
||||
["declare interns var" "true" "(do (declare fwd-declared) (var? (var fwd-declared)))"]
|
||||
["def redefine" "100" "(do (def one 1) (def one 100) one)"]
|
||||
["def in fn mutates" "[:default :meow]" "(do (def a :default) (def set-a (fn* [v] (def a v))) (let* [before a] (set-a :meow) [before a]))"]
|
||||
["call literal fn" "1" "((fn* [] 1))"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue