[gambit-list] eval order, define vs define-macro
Stephane Le Cornec
coleste at videotron.ca
Thu May 11 10:38:38 EDT 2006
(define (foo x) x)
(define-macro (bar x) `(+ ,x ,(foo x)))
(define (baz x) (bar x))
> (load "test")
*** ERROR IN #<procedure #2>, "test.scm"@2.1 -- Unbound variable: foo
1>
I was a little surprised of the result. OTOH:
(define (baz2 x) (bar2 x))
(define-macro (bar2 x) `(+ ,x 2))
fails on (baz2 2) as expected while the reverse works properly.
I don't understand why the eval order does not work for define-macro.
Is the behavior an implementation choice? And if so why is it wanted?
--
Stephane!
coleste at videotron.ca (Stephane Le Cornec)
+------------------- Made with recycled electrons. --------------------+
| #include <disclaimer.h> Kebekkujin desu. |
+---------<http://www.starfiredesign.com/starfire/index.html>----------+
More information about the Gambit-list
mailing list