[plt-scheme] eval not aware of vars defined in same function as caller
(define f 5)
(define test
(lambda ()
(define g 4)
(display (eval '(* f 3)))(newline)
(display (eval '(* g 6)))))
(test)
============>
15
reference to undefined identifier: g
Why is g undefined? EVAL should be using the current
namespace, where g /is/ defined. The "PLT MzScheme:
Language Manual" says:
(eval expr [namespace]) evaluates expr in namespace,
or in the current namespace if namespace is not
supplied.
The error is the same if I specify (current-namespace)
in the latter EVAL call.
thank you.
George Herson