Macro function executed twice in SBCL
Posted: Thu Jan 30, 2014 8:09 pm
Hi all,
I was wondering if someone could explain this SBCL behaviour to me. I have a macro that appears to be executed twice.
First, something that works just fine:
But if I return a quasiquoted lambda, I get the message printed twice:
I tried it under LispWorks 6.1.1 and I got what I expected:
So I thought I'd step it under SBCL, but that Heisenbugged:
Or put it in a loop:
What's going on here? Is it something to do with returning the lambda? That it's compiled? This seems too fundamental to be a genuine SBCL bug - and I've tried it with old and brand-new versions (1.0.57, 1.1.15), with the same results.
I was wondering if someone could explain this SBCL behaviour to me. I have a macro that appears to be executed twice.
First, something that works just fine:
Code: Select all
(defmacro heaven ()
(print "Everything is fine.")
100)
=> HEAVEN
(heaven)
"Everything is fine."
=>100
Code: Select all
(defmacro hell ()
(print "You can say that again!")
`(lambda ()
100))
=> HELL
(hell)
"You can say that again!"
"You can say that again!"
=> #<FUNCTION (LAMBDA ()) {100643AC5B}>
Code: Select all
... same def...
(hell)
"You can say that again!"
=> #<anonymous interpreted function 226EB102>
Code: Select all
(step (hell))
"You can say that again!"
=> #<FUNCTION (LAMBDA () :IN #:DROP-THRU-TAG-1) {100670BCAB}>
Code: Select all
(dotimes (n 5) (hell))
[i]"You can say that again!" [/i]
NIL