[gambit-list] macro problems

Adrien Piérard pierarda at iro.umontreal.ca
Thu Aug 13 06:27:37 EDT 2009


2009/8/13 lowly coder <lowlycoder at huoyanjinjing.com>:
> The following confuses me even more:

You are mixing environments…

> (define-macro (test)
>  (define bar 3)

Bar is defined in the body of the macro

>  (pp (eval '(+ 1 2)))

No bindings here, no problem

>  (pp bar)

This is bound to 3

>  (pp (eval 'bar)))

This bar is in another world.
Try to add the second parameter to eval (the environment), just to be sure

> (test)

fail.



In other words, look at that
(define-macro (foo)
  (define bar 3)
  (eval '(define bar "hi"))
  (pp bar)
  (eval '(pp bar)))

(foo)


See the point?

P!

-- 
Français, English, 日本語, 한국어



More information about the Gambit-list mailing list