flan/test/programs/pkg-macro-idle.flan
Joseph Ferano 6bc4726ddd C-x C-e expands, and a declaration is not an expression
Parse.expr never ran the expander, so a macro call typed as a bare
expression was an unknown name -- a package's and the prelude's alike,
which is what said the gap was older than importable macros. It is the
wrap Parse.decl already had, applied to the other entry point, with
Parse.with_imported in front of it in Session.eval_expr because the one
expression an editor sends carries no import.

The decision that was waiting: an expression that expands to a
declaration is refused by name, in the head dispatch rather than in a
walk over what the expander answered, so a nested one and a hand-typed
one get the same sentence. A quasiquoted declaration is still a value.

The spin refusal fires on this path; the ring cannot reach it, because a
ring is refused while its own package is parsed. Expansion happens
before the thunk is built, so the 5s three-way wait is untouched.
2026-09-13 17:54:36 +07:00

18 lines
758 B
Plaintext

;;;; A file that imports a macro package and calls nothing from it, so it
;;;; builds. It exists for C-x C-e.
;;;;
;;;; A refusal that fires while the program is being built proves nothing about
;;;; the expression path: the session would never be created. Here the session
;;;; creates cleanly -- [Macro.program] scans and finds no call, so no module is
;;;; compiled -- and the first thing that ever expands [s/spin] is an expression
;;;; typed at the REPL.
;;;;
;;;; The ring is deliberately not imported here: a ring is refused while the
;;;; *package* is parsed, so no importer of one can be loaded at all and no
;;;; session over it can exist. See the assertion beside this one.
(import s "pkgs/macspin")
(import mac "pkgs/mac")
(defn main [] i32 0)