Re: Stepper-friendly macros: clarification
> we will add an operator something like this:
Thanks, that's very fine :-))
2013/3/8, Martin Simmons <martin@lispworks.com>:
>
>>>>>> On Sun, 3 Mar 2013 21:31:38 +0400, Denis Budyak said:
>>
>> Hi David, List
>> > I haven't ever tried using an alternative debugger on Lisp code
>> Maybe I didn't state this clear. I'm not talking about alternative
>> stepper. I only talk about small additional feature which (I hope) can
>> be added to existing stepper. Sometimes you want to see macroexpanded
>> code, that's ok. Sometimes (e.g. with "iterate") you would not want to
>> see messy macroexpanded code, but might want just to set a breakpoint
>> at some clause and stop at it at the beginning of every iteration. My
>> goal is to enable macro writer to tell IDE which points are "stepable"
>> and to what place in macroexpanded source they correspond. This would
>> not disable ability of seeing macroexpanded code, but would add a
>> choice which is very convinient.
>>
>> Small example:
>>
>> (defmacro breakpointable (x) x)
>> (defun f1 () (breakpointable
>> ( ; one can set breakpoint here
>> + 2 2 )))
>>
>> (defmacro non-breakpointable (x) (copy-tree x))
>> ; Any macro where source code is copied
>> ; instead of splicing, would lead to
>> ; source position loss. 'iterate' is one example
>>
>> (defun f2 () (non-breakpointable
>> ( ; can't set breakpoint here as source was copied
>> + 2 2 )))
>>
>>
>> (defmacro assign-source (literal expanded)
>> "Assigns a literal source place for expanded code place.
>> Think of it as a kind of #line cpp directive for stepper"
>> `(setf (car ,literal) (car ,expanded)
>> (cdr ,literal) (cdr ,expanded)
>> ,expanded ,literal))
>>
>> (defmacro breakpointable-again (x)
>> (let ((result (copy-tree x)))
>> (assign-source x result)
>> result))
>>
>> (defun f3 ()
>> (breakpointable-again
>> ( ; can set a breakpoint
>> + 2 2)))
>>
>> In this example, all works fine, but there is a problem: literal
>> source is modified.
>> Indeed in some cases this approach does not work with "iterate".
>> My suggestion is to add one macro, "assign-source", but with correct
>> definition, which does not smash literal data. I was unable to write one,
>> as
>
> Thanks for the suggestion -- we will add an operator something like this:
>
> (dspec:replacement-source-form original-form new-form)
>
> which can be wrapped around copied code to indicate the original form.
> E.g. walk-expr in iterate would return
>
> `(dspec:replacement-source-form ,expr ,(prognify body))
>
> --
> Martin Simmons
> LispWorks Ltd
> http://www.lispworks.com/
>
> _______________________________________________
> Lisp Hug - the mailing list for LispWorks users
> lisp-hug@lispworks.com
> http://www.lispworks.com/support/lisp-hug.html
>
>
_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html