flan/test/programs/pkg-macro-bare.flan
Joseph Ferano 1898a3157d Macros come from a package now, and the refusal's reason was wrong
Load.program takes forms: it reads the import forms, resolves them with the
one resolver it always had, and parses the file with the packages' macros in
front of it. The refusal said this needed a second import resolver at the Form
level. It did not notice that the file being compiled is parsed before Load
runs too, so no shape of the feature could have left import resolution where
it was.

Names arrive qualified, as a defn's do. (mac/twice 4) is a call and (twice 4)
is an unknown name.

Stopped mid-task: dune test was never run and the acceptance wiring is
unfinished. HANDOFF-macros.md has what is left.
2026-09-13 15:40:08 +07:00

15 lines
603 B
Plaintext

;;;; The other half of the qualified-name rule: importing a package makes
;;;; nothing globally visible. [mac/twice] is the macro's name here and [twice]
;;;; is not a name at all, exactly as for a defn the package declares.
;;;;
;;;; It comes back as an unknown *function* rather than as an unknown macro,
;;;; and that is the honest answer: only [mac/twice] is in the expander's set,
;;;; so the walk never sees a head it recognises and the call reaches the
;;;; checker as what it looks like. Never built: the refusal is the test.
(import mac "pkgs/mac")
(defn main [] i32
(print (twice 4))
0)