(defmacro do-grid [[r rows c cols] & body] ...) — positional names, a [ ] pattern wherever an argument is a vector, and & for the tail. The reading of the list lives in Expand, below both sides that need it: Parse turns it into the bindings a macro body opens with, and Macro checks a call against the same reading before expanding it, so arity and shape are refused with the call's own location rather than with the Loc.from_macro stamp every node of an expansion carries. The breaking half: [args] used to bind the whole argument list and now binds the first argument. The whole list is [& args], and every defmacro in the tree — prelude, vendor, tests, the elisp fixtures — was migrated to it. One grammar, not a legacy mode.
22 lines
814 B
Plaintext
22 lines
814 B
Plaintext
;;;; Two macros whose bodies call each other, and the calls are real ones --
|
|
;;;; outside any quasiquote, so each has to run while the other is being
|
|
;;;; compiled. A defmacro has to be compiled before the call it expands, so a
|
|
;;;; ring has no order to be compiled in: neither can go first and neither
|
|
;;;; becomes compilable by waiting. The pre-pass names them both.
|
|
;;;;
|
|
;;;; A call inside a quasiquote is a different thing and is not a cycle. It is
|
|
;;;; part of what the macro *answers*, expanded again after it returns, and two
|
|
;;;; macros can quasiquote each other forever without either needing the other
|
|
;;;; to exist first -- see macro-spin.flan, which is bounded rather than
|
|
;;;; refused.
|
|
|
|
(defmacro ping [& args]
|
|
(pong args))
|
|
|
|
(defmacro pong [& args]
|
|
(ping args))
|
|
|
|
(defn main [] i32
|
|
(ping 1)
|
|
0)
|