Allows source location to work when a form is copied by a macro.
replacement-source-form original-form new-form => new-form-value
A Lisp form.
A Lisp form.
A Lisp object.
A call to
replacement-source-form can be used to allow the debugger and stepper to identify that original-form has been replaced by new-form in a macro expansion. Forms in a macro expansion that are
eq to forms in the arguments to the macro will be identified automatically, but some macros (such as
iterate) need to generate new forms that are equivalent to the original forms and wrapping them with
replacement-source-form allows them to be identified too.
original-form should be a form that occurred in the arguments to the macro and does not otherwise occur in the expansion of the macro. new-form should be a form that was created by the macro.
The value of new-form, new-form-value, is returned when the
replacement-source-form form is evaluated.
dspec:replacement-source-form, the calls to
pprint would be unknown to the debugger and stepper because the forms do not occur in the original source code:
(defmacro pprint-for-print (&body forms)
,@(loop for form in forms
(if (and (consp form)
(eq (car form) 'print))
(pprint ,@(cdr form)))
LispWorks User Guide and Reference Manual - 13 Feb 2015