load in environment

2007-07-05 Thread Jon Wilson
Hi, I was wondering if there is a built-in way to eval the contents of a file inside of an environment other than (current-module)? We have eval and primitive-eval, and it seems that load is currently (conceptually) a read, primitive-eval loop until eof is reached. Why not allow an environme

Re: load in environment

2007-07-05 Thread Stephen Compall
Jon Wilson wrote: The second way is to make the desired environment temporarily be the current module: (define load-env-2 filename env) (let ((real-current-module (current-module))) (set-current-module! env) (load filename) (set-current-module! real-current-module))) The second way h

Re: load in environment

2007-07-05 Thread Jon Wilson
Stephen Compall wrote: What other Guile state might you want to modify in the dynamic context of a load, though? Dynamic-wind looks like a quite good idea here. I'll probably use that. Thanks. Well, I'm writing a function to load up some data from a file and stick it in a hash table.

Re: load in environment

2007-07-05 Thread Stephen Compall
Jon Wilson wrote: I'm not sure if my-table is what you meant by "other guile state" that I might want to modify, but it is definitely something visible to the rest of the program which I want to modify by loading filename. I'm saying that there are many possible system properties one might wan

Re: load in environment

2007-07-05 Thread Jon Wilson
Stephen Compall wrote: The closure isn't "inside" any module; you merely gave it a binding in your temporary module. A. You seem to have effectively defuzzied my thinking. Again, thanks! Jon ___ Guile-user mailing list Guile-user@gnu.org http: