This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Jim Blandy <jimb@red-bean.com> writes: > > I did some experiments with local-eval and found a funny behaviour of > > "defined?". Is it not possible to quote for a local evaluation? > > > > (define the-environment > > (procedure->macro (lambda (exp env) `',env))) > > > > (define e (let ((a 3)) (the-environment))) > > > > (local-eval 'a e) => 3 > > (local-eval '(defined? 'a) e) => #f > > > > The variable a evaluates to 3 but Guile says, that it is not defined. > > I think defined? only checks top-level definitions. Since defined? is a procedure in Guile (It is a macro in SCM.) this is the only possible behaviour because the procedure evaluates in the environment in which it is defined. It is not possible for `defined?' to have any information about the environment in which it is evaluated. (We could of course add an optional environment argument.) /mdj