I was just reading the chapter on macros in Paul Graham's ANSI Common
Lisp, and I came across the part regarding define-modify-macro. It
explains why a custom definition of incf like the following is no
good:
(defmacro incf* (x feoptional (y 1))
' ( setf ,x (+ ,x , y ) ) )
because then things like (incf* (car (push 1 lst))), assuming lst were
initially NIL for instance, would not expand correctly.
Now, that's all fine and well, and I see the point perfectly. But I
was just a little curious about something that the book actually
doesn't explain:
Is define-modify-macro just a shortcut macro that we use as "syntactic
sugar" (and thus implementable somehow with DEFMACRO for example) or
is its presence inevitable because the rest of the macro system is not
powerful enough to encompass the previous situation concerning INCF
and others analogous to it?


|