emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is FUNC in cl-callf not allowed to be an expression?


From: Michael Heerdegen
Subject: Re: Why is FUNC in cl-callf not allowed to be an expression?
Date: Thu, 23 May 2019 03:50:38 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Michael Heerdegen <address@hidden> writes:

> With our current implementation of local macros, only the expansion
> (compile) time matters, so this not so simple to do:
>
> (let ((l '(0 1 2 3))
>       (i '(0 1 2 3))
>       (flag nil))
>   (cl-macrolet ((yyy () (if flag '(nth 2 l) '(nth 3 i))))
>     (cl-symbol-macrolet ((xxx (yyy)))
>       (setf xxx 0)
>       (list l i))))
> |- void-variable: flag

Most Common Lisps seem to barf in this case (macro definition
referencing local variables).  I only found it explicitly described
here:

  http://www.lispworks.com/documentation/HyperSpec/Body/s_flet_.htm#macrolet

Anyway, I would like to speak out that one should not do that, how about
this?

From ae8e42cf23e4883aed0177aad30d56f0e3e5086b Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <address@hidden>
Date: Thu, 23 May 2019 03:33:04 +0200
Subject: [PATCH] * doc/misc/cl.texi (Macro Bindings): State expansion time

---
 doc/misc/cl.texi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi
index eb06791ba9..c96b9b6c3e 100644
--- a/doc/misc/cl.texi
+++ b/doc/misc/cl.texi
@@ -1360,6 +1360,8 @@ Macro Bindings
 affect only calls that appear physically within the body
 @var{forms}, possibly after expansion of other macros in the
 body.
+
+Like global macros local macros are expanded at compile-time.
 @end defmac

 @defmac cl-symbol-macrolet (address@hidden) address@hidden
--
2.20.1


Michael.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]