[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: |
Wed, 22 May 2019 03:00:11 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Stefan Monnier <address@hidden> writes:
> Yeah, maybe a "place alias" is a generalization of symbol-macro.
>
> Actually, no: [...]
I see Graham using symbol macros to abbreviate normal code in "On Lisp".
That's enough evidence for me not to touch symbol-macrolet.
> [...] symbol-macro can also expand to other macro-calls which are
> supposed to be re-expanded at each use-site, AFAIK, so it can
> macro-expand to something different every time the "variable" is
> referenced, which is not the case of places, I think.
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
(defvar flag t)
(defmacro zzz () (if flag '(nth 2 l) '(nth 3 i)))
(let ((l '(0 1 2 3))
(i '(0 1 2 3))
(flag nil))
(cl-symbol-macrolet ((xxx (zzz)))
(setf xxx 0)
(list l i)))
==> ((0 1 2 3)
(0 1 2 0)) ;; FLAG has been checked at expansion time
I could move the check of FLAG into the expansion, but that's not what
you meant, and since you made `if` forms place expressions, it would not
even be a counterexample any more.
Michael.
- Re: Why is FUNC in cl-callf not allowed to be an expression?, (continued)
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/17
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Stefan Monnier, 2019/05/18
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/20
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Stefan Monnier, 2019/05/20
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/20
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Noam Postavsky, 2019/05/21
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/21
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Stefan Monnier, 2019/05/21
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Andy Moreton, 2019/05/21
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/23
- Re: Why is FUNC in cl-callf not allowed to be an expression?,
Michael Heerdegen <=
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/22
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Stefan Monnier, 2019/05/22
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/23
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Stefan Monnier, 2019/05/24
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/28
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/26
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Stefan Monnier, 2019/05/29
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/15