From 6ccad80f7b91a329f4543e4a6661955e756ce1de Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 17 May 2021 07:31:44 -0700 Subject: doc: macrolet doesn't contain top-level forms. * txr.1: For eval and for compilation, document that symacrolet and macrolet do not enclose multiple top-level forms. --- txr.1 | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/txr.1 b/txr.1 index ec2b36be..24122eb6 100644 --- a/txr.1 +++ b/txr.1 @@ -17869,6 +17869,25 @@ forms the reference model for how the .code load function processes top-level forms. +Note that, according to these rules, the constituent body forms of a +.code macrolet +or +.code symacrolet +top-level form are not individual top-level forms, even if the +expansion of the construct combines the expanded versions of those +forms with +.codn progn . + +The form +.code "(macrolet () (defmacro foo ()) (foo))" +will therefore not work correctly. However, the specific problem in +this situation can be be resolved by rewriting +.code foo +as a +.code macrolet +macro: +.codn "(macrolet ((foo ())) (foo))" . + See also: the .code make-env function. @@ -76778,6 +76797,15 @@ This means that it is not a form based on any of the operators or .codn eval-only . +Note that the constituent body forms of a +.code macrolet +or +.code symacrolet +top-level form are not individual top-level forms, even if the +expansion of the construct combines the expanded versions of those +forms with +.codn progn . + .SS* File Compilation Model The file compiler reads each successive forms from a file, performs a partial -- cgit v1.2.3