aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorŠtěpán Němec2021-04-24 21:19:48 +0200
committerŠtěpán Němec2021-04-25 09:30:16 +0200
commitbda866009b48b73053d479ffb88e7a7ffbcf7996 (patch)
treefd250bc58408ab904a61183adb2e2eec6328b426
parent86d1b4d88f2999d2b0f94619dc53092bddfa0ec0 (diff)
downloademacs-bda866009b48b73053d479ffb88e7a7ffbcf7996.tar.gz
emacs-bda866009b48b73053d479ffb88e7a7ffbcf7996.zip
* doc/lispref/macros.texi (Eval During Expansion): Copy edit.
-rw-r--r--doc/lispref/macros.texi26
1 files changed, 14 insertions, 12 deletions
diff --git a/doc/lispref/macros.texi b/doc/lispref/macros.texi
index 7c090aebc86..b8df363614d 100644
--- a/doc/lispref/macros.texi
+++ b/doc/lispref/macros.texi
@@ -480,15 +480,17 @@ in expressions ordinarily.
480 480
481 Another problem can happen if the macro definition itself 481 Another problem can happen if the macro definition itself
482evaluates any of the macro argument expressions, such as by calling 482evaluates any of the macro argument expressions, such as by calling
483@code{eval} (@pxref{Eval}). You have to take into account that the 483@code{eval} (@pxref{Eval}). You have to take into account that macro
484context of the caller is not accessible at that time since the macro expansion 484expansion may take place long before the code is executed, when the
485may take place long before the code is executed. Also if your macro definition 485context of the caller (where the macro expansion will be evaluated) is
486does not use @code{lexical-binding} its own variables may hide the 486not yet accessible.
487user's variables, if the user happens to use a 487
488variable with the same name as one of the macro arguments. Inside the 488 Also, if your macro definition does not use @code{lexical-binding}, its
489macro body, the macro argument binding is the most local binding of this 489formal arguments may hide the user's variables of the same name. Inside
490variable, so any references inside the form being evaluated do refer to 490the macro body, the macro argument binding is the most local binding of
491it. Here is an example: 491such variable, so any references inside the form being evaluated do refer
492to it. Here is an example:
493
492@example 494@example
493@group 495@group
494(defmacro foo (a) 496(defmacro foo (a)
@@ -510,9 +512,9 @@ it. Here is an example:
510@code{x}, because @code{a} conflicts with the macro argument variable 512@code{x}, because @code{a} conflicts with the macro argument variable
511@code{a}. 513@code{a}.
512 514
513 Also the expansion of @code{(foo x)} above will return something 515 Also, the expansion of @code{(foo x)} above will return something
514different or signal an error when the code is compiled since in that case 516different or signal an error when the code is compiled, since in that case
515@code{(foo x)} is expanded during compilation whereas the execution of 517@code{(foo x)} is expanded during compilation, whereas the execution of
516@code{(setq x 'b)} will only take place later when the code is executed. 518@code{(setq x 'b)} will only take place later when the code is executed.
517 519
518 To avoid these problems, @strong{don't evaluate an argument expression 520 To avoid these problems, @strong{don't evaluate an argument expression