[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, 16 May 2019 16:37:26 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Stefan Monnier <address@hidden> writes:
> Hmm... that's indeed what I see, but I haven't yet understood why that
> is (or rather, why that doesn't happen to your gv-ad-hoc-place). I
> guess that qualifies as a bug in gv-synthetic-place (not that it
> matters too much: I can't find a single use of it).
Well, let's see:
;; works:
(let ((l '(0)))
(cl-symbol-macrolet ((p (gv-synthetic-place (car l) (lambda (v) `(setcar l
,v)))))
(setf p 1))
l) ;; ==> (1)
;; dosn't work:
(let ((l '((0))))
(let ((cl (car l)))
(cl-symbol-macrolet ((p (gv-synthetic-place cl (lambda (v) `(setcar cl
,v)))))
(setf p 1)))
l) ;; ==> ((0))
;; but this works
(let ((l '((0))))
(let ((cl (car l)))
(setf (gv-synthetic-place cl (lambda (v) `(setcar cl ,v))) 1))
l) ;; ((1))
The problem in the second case is that `cl-symbol-macrolet' is too
eager: it also macroexpands the symbol expansion `p' inside the `setf',
i.e. it expands the `gv-synthetic-place' macro call, to just `cl', so
you get (setf cl 1).
That just doesn't happen to my version since it's a function instead of
a macro (and the compiler macro seems to be applied later).
Any suggestions?
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?, Stefan Monnier, 2019/05/10
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/10
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Stefan Monnier, 2019/05/13
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/14
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/14
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Stefan Monnier, 2019/05/14
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/15
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/15
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/15
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Stefan Monnier, 2019/05/16
- 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/16
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Stefan Monnier, 2019/05/16
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/16
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Stefan Monnier, 2019/05/16
- 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