Watch out with backquote and quote!

Discussion of Common Lisp
Post Reply
Jasper
Posts: 209
Joined: Fri Oct 10, 2008 8:22 am
Location: Eindhoven, The Netherlands
Contact:

Watch out with backquote and quote!

Post by Jasper » Mon Sep 21, 2009 2:14 pm

Just like quote, if you alter the resulting list, it will alter your code there!

I today and a week ago had a big wtf when destructive functions altered my code. I knew quoted code could do that, but didn't realize backquoted code does it too. The second i was using LML2. To be more precise it was something like:

Code: Select all

(eval `(html-file-page (,filename) ,@auch-i-got-altered))
Rather unexpected to see that alter it. The documentation of neither EVAL or the linked MACROEXPAND-1 say anything about being destructive, so it is probably LML2. Really bad form to use EVAL though. I don't really like LML2 earlier either, doesn't have very good documentation, but it did work out of the box.

Post Reply