[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#57397: cl-letf blindly macroexpands places
From: |
Stefan Monnier |
Subject: |
bug#57397: cl-letf blindly macroexpands places |
Date: |
Thu, 25 Aug 2022 15:33:45 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
> to support symbol macros better:
>
> #+begin_src emacs-lisp
> (defun cl--letf (bindings simplebinds binds body)
> ;; It's not quite clear what the semantics of cl-letf should be...10..
> (if (null bindings)
> (if (and (null binds) (null simplebinds)) (macroexp-progn body)..20..)
> (let* ((binding (car bindings))
> (place (macroexpand (car binding)
> macroexpand-all-environment)));<--!!
> (gv-letplace (getter setter) place..12..))))
> #+end_src
>
> I think this is an error in the general case. It's at least always
> wrong when (car PLACE) is a macro name with a gv spec defined.
Indeed, defining a gv spec for a macro is fiddly.
> Maybe it's enough to expand only symbol macros?
Yes, that should still cover the original need in bug#26073 without
breaking your use case.
But regardless of this, we should probably turn `gv-synthetic-place`
into a function so it's more robust.
Stefan