[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.lisp

Tracing macro expansions.

Kaz Kylheku

12/1/2015 5:46:00 PM

$ cat macro-error.tl
(defmacro local-alias (a b . forms)
^(macrolet ((,a (. args) ^(,',b ,*args)))
,*forms))
$ txr -i macro-error.tl
1> (local-alias f new (f foo) d)
** make-struct: foo does not name a struct type
** possibly triggered by form (make-struct 'foo (list))
** ... an expansion at /usr/local/share/txr/stdlib/struct.tl:183 of (new foo)
** ... an expansion at macro-error.tl:2 of (f foo)
** which is located at expr-1:1
2>

We see that the make-struct was generated from (new foo) by macro code
which lives at line 183 in struct.tl. This (new foo) was in turn generated
by a macrolet.

Note that the macrolet doesn't actually reside in macro-error.tl; all that
is found there is a quasiquote form which writes the macrolet. Yet, the
expansion of (f foo) is still traced to that location through the code that was
generated by the quasiquote.

--
Music DIY Mailing List: http://www.kylhe...
ADA MP-1 Mailing List: http://www.kylhe...