guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: eval


From: Dirk Herrmann
Subject: Re: eval
Date: Mon, 5 Feb 2001 00:51:46 +0100 (MET)

On 4 Feb 2001, Neil Jerram wrote:

>     Dirk> Well, I seem to have expressed myself badly: The environment
>     Dirk> will be restored by eval.  However, the question whether the
>     Dirk> return value of (interaction-environment) is changed is not
>     Dirk> part of 'eval any more.
> 
> A quick check: I believe that (interaction-environment) is the same as
> what I've been calling (current-environment), i.e. the environment in
> which the next thing that is entered will be evaluated.  Is that still
> correct in your generalization?

Hmmm, I am not sure if we really mean the same thing here:  I use the term
(interaction-environment) in the following sense:  
interaction-environment is a function, that returns an environment.  It is
meant to return the environment, in which the next interactively entered
expression will be evaluated.  In other words, when the repl has read an
expression, it will call 'eval with (interaction-environment) as the
environment parameter.  IMO, there are few other situations in a scheme
system, where (interaction-environment) should be of interest.

R5RS says about interaction-environment:

   optional procedure: interaction-environment 

       This procedure returns a specifier for the environment that
       contains implementation-defined bindings, typically a superset of
       those listed in the report. The intent is that this procedure
       will return the environment in which the implementation would
       evaluate expressions dynamically typed by the user. 

In other words, (interaction-environment) is a function that is provided
in order to be able to implement repls.  Maybe this also answers the
following question:

>     Dirk> I. e. the control about when (interaction-environment)
>     Dirk> changes is in the hand of the caller of eval.  However, the
>     Dirk> name the-module* is definitely bad.
> 
> Interesting, but I can't think of any cases where it would be useful
> not to do a (set-interaction-environment the-module*), i.e.  for
> (interaction-environment) to be other than the selected module's
> environment. [...]

Well, I think there are actually only a _few_ situations where the result
of (interaction-environment) should change:  The repl itself can decide
whether the interaction environment should be changed.  Further, if there
is a GUI, the user might for example have a menu item "select interaction 
environment".  What other situations are there, where the interaction
environment should change?

Best regards,
Dirk Herrmann




reply via email to

[Prev in Thread] Current Thread [Next in Thread]