2009/8/14 lowly coder lowlycoder@huoyanjinjing.com:
why is:
(load "t1.scm") (define x 20)
Load works at run time.
(define foo "bar.scm") (lofd foo)
valid, where as: (define-macro (foo) (load "t1.scm") (define x 20)) result in a ill-placed define error?
You have to think that macros is a different language than scheme that just conveniently happen to have a similar syntax.
I was under the impression that scheme define-macro was just scheme code; it appears that the environment the macro is run in is different from the runtime ones?
I think told you yesterday, with sample code, that macros accessed basically two environments, and handled them differently than the runtime code. And also, you *want* a different environment than the runtime one…
I *strongly* suggest you buy and read "Lisp In Small Pieces" by Christian Queinnec. All your macros questions, current and future, are answered there.
P!