Macros receive &form and &env
A macro body can now read &form (the call form) and &env (a map of the in-scope local symbols), like Clojure. This is what core.logic's matche/defne use to tell a pattern symbol that names an enclosing local from a fresh pattern var — so locals-membero and the recursive checko in `matches` now compute correctly. The suite reaches 535/2/0 (the last two are constraint reification ORDER, where the constraint set is right but it is spliced from a set whose iteration order differs from the JVM — a host set-ordering divergence, not a bug). &form/&env are clojure.core dynamic vars bound around each expander call rather than prepended params, so the macro calling convention is unchanged and the mint stays consistent (the seed prelude is byte-identical; only the analyzer carries the env into form-expand-1). macroexpand-1 passes an empty env. corpus.edn: the ~@ unquote row is now a boolean compare (a bare clojure.core/ unquote-splicing symbol evaluates to an unbound var, not the symbol).
This commit is contained in:
parent
f46772d576
commit
438742702a
4 changed files with 57 additions and 39 deletions
|
|
@ -3348,5 +3348,5 @@
|
|||
{:suite "symbols / interning" :label "(str sym) is the symbol's interned name (identity-stable)" :expected "[true true]" :actual "(let [s (quote ?a)] [(identical? (name s) (str s)) (= (str s) \"?a\")])"}
|
||||
{:suite "symbols / interning" :label "equal symbols share an interned name string" :expected "true" :actual "(let [a (quote ?foo) b (quote ?foo)] (identical? (name a) (name b)))"}
|
||||
{:suite "reader / unquote" :label "~x reads as clojure.core/unquote" :expected "true" :actual "(= (quote (clojure.core/unquote v)) (read-string \"~v\"))"}
|
||||
{:suite "reader / unquote" :label "~@x reads as clojure.core/unquote-splicing" :expected "clojure.core/unquote-splicing" :actual "(first (read-string \"~@xs\"))"}
|
||||
{:suite "reader / unquote" :label "~@x reads as clojure.core/unquote-splicing" :expected "true" :actual "(= (quote clojure.core/unquote-splicing) (first (read-string \"~@xs\")))"}
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue