I'm trying to write a local macro with MACROLET that is supposed to do
basically something that (I'll save the details), if I were to write a
global macro, then the appropriate choice would be the straightforward
DEFINE-MODIFY-MACRO. But of course I can't use the latter in this
case, so could I possibly achieve the same effect by taking advantage
of GET-SETF-METHOD? In other words, when you can't use DEFINE-MODIFY-
MACRO, is writing a macro that uses GET-SETF-METHOD the right path to
follow?
On May 24, 5:22 pm, ···········@gmail.com wrote:
> I'm trying to write a local macro with MACROLET that is supposed to do
> basically something that (I'll save the details), if I were to write a
> global macro, then the appropriate choice would be the straightforward
> DEFINE-MODIFY-MACRO. But of course I can't use the latter in this
> case, so could I possibly achieve the same effect by taking advantage
> of GET-SETF-METHOD? In other words, when you can't use DEFINE-MODIFY-
> MACRO, is writing a macro that uses GET-SETF-METHOD the right path to
> follow?
OOPS ... actually I meant GET-SETF-EXPANSION. Sorry about that :)
On May 24, 5:22 pm, ···········@gmail.com wrote:
> I'm trying to write a local macro with MACROLET that is supposed to do
> basically something that (I'll save the details), if I were to write a
> global macro, then the appropriate choice would be the straightforward
> DEFINE-MODIFY-MACRO. But of course I can't use the latter in this
> case,
Please tell more about your case. Why won't define-modify-macro work?
The solution you are going for does what you ask for, but is a bit
hairy. There might be easier, higher-level ways to solve whatever
issue you are having.
> In other words, when you can't use DEFINE-MODIFY-MACRO,
> is writing a macro that uses GET-SETF-METHOD the right path to
> follow?
> OOPS ... actually I meant GET-SETF-EXPANSION. Sorry about that :)
It is possible, as define-modify-macro is a macro built on top of get-
setf-expansion. The expansion of define-modify-macro includes a
defmacro form. You can look up the definition of define-modify-macro
in your implementation or take a portable version, and write your own
let-modify-macro macro analogue to it, except that yours expands into
macrolet instead of defmacro.
- Willem
On 25 Mag, 10:23, Willem Broekema <········@gmail.com> wrote:
> On May 24, 5:22 pm, ···········@gmail.com wrote:
>
> > I'm trying to write a local macro with MACROLET that is supposed to do
> > basically something that (I'll save the details), if I were to write a
> > global macro, then the appropriate choice would be the straightforward
> > DEFINE-MODIFY-MACRO. But of course I can't use the latter in this
> > case,
>
> Please tell more about your case. Why won't define-modify-macro work?
> The solution you are going for does what you ask for, but is a bit
> hairy. There might be easier, higher-level ways to solve whatever
> issue you are having.
>
> > In other words, when you can't use DEFINE-MODIFY-MACRO,
> > is writing a macro that uses GET-SETF-METHOD the right path to
> > follow?
> > OOPS ... actually I meant GET-SETF-EXPANSION. Sorry about that :)
>
> It is possible, as define-modify-macro is a macro built on top of get-
> setf-expansion. The expansion of define-modify-macro includes a
> defmacro form. You can look up the definition of define-modify-macro
> in your implementation or take a portable version, and write your own
> let-modify-macro macro analogue to it, except that yours expands into
> macrolet instead of defmacro.
>
> - Willem
OK. Thanks Willem.