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

Re: [Scheme-reports] 6.7.4 load



On Wed, 1 Jun 2011, Jonathan Kraut wrote:

> The 'load' procedure doesn't specify what should happen when it is
> called from with a module. While it is clearly meant to be used at the
> top level of a program or in an interactive REPL, as specified it may be
> also used from within a module. In that case, in which environment is
> the content of the file evaluated? Are bindings created by the file
> visible to code in the module? What if the file contains module
> definitions or happens to redefine existing bindings? etc etc
>
> Perhaps the contents should always be evaluated in the
> interaction-environment. Or that could be a default and 'load' could
> take an optional argument that specifies an environment.

Very good question.  There may indeed be thorny problems with things like 
loading definitions into possibly immutable module environments.  For 
expressions, LOAD reduces to a sequence of reads and EVALs, for which an 
environment argument can make sense as in R6RS.

As an obvious thing to try, I foresee people trying to LOAD a module's own 
definitions (as opposed to using INCLUDE), thus trying to customize the module 
at runtime, and not understanding why this kind of thing would not work (in 
most implementations, I presume, although I suppose one could make it work).

A tangential question - while evaluating the definitions in a module, the 
environment in effect is not the interaction environment, or is it?  (Both 
possibilities are thinkable, e.g., the interaction environment could perhaps be 
a parameter that is set to the module environment while running the code inside 
the module).


_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports