This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: difference between using eval from the interactive prompt and from a file?
- From: Helmut Eller <eller dot helmut at gmail dot com>
- To: kawa at sources dot redhat dot com
- Date: Fri, 11 Nov 2011 11:02:48 +0100
- Subject: Re: difference between using eval from the interactive prompt and from a file?
- References: <CAE2A29A.255AF%lexaay@gmail.com>
* alex mitchell [2011-11-11 01:59] writes:
> I know that eval is generally discouraged, but I've been looking at using
> it for what (I think) is a valid reason. However, I've immediately run
> into a problem.
>
> I notice that this code:
>
> (define (myproc)
> (display "myproc\n"))
>
> (if (environment-bound? (interaction-environment) 'myproc)
> (eval '(myproc))
> (display "not bound\n"))
>
> gives the result "myproc" if I type the code into the kawa prompt
> interactively, but gives the result "not bound" if I save it in a file,
> say "evaltest.scm", and then run "kawa evaltest.scm". Is there a reason
> why, when running from a file, eval can't see myproc? I'm guessing it has
> something to do with the way the file is compiled, and when top-level
> definitions are evaluated. Anyone have any insight or suggestions?
R7RS section 5.1 Programs:
Expressions occurring at the top level of a program are
interpreted imperatively; they are executed in order when
the program is invoked or loaded, and typically perform
some kind of initialization.
So I think this is one more case where Kawa is not standard conform.
Helmut