This is the mail archive of the guile@sourceware.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]

Re: loading files locally


Mikael Djurfeldt <mdj@mdj-pc.nada.kth.se> writes:

> Klaus Schilling <Klaus.Schilling@home.ivm.de> writes:
> 
> > is there a way to load files in a way that they get evaluated
> > in the current environment instead of the global one?
> 
> Yes, from Kent R. Dybvigs book "The Scheme Programming Language"
> (http://www.scheme.com/tspl2ed.html):
> 
> (use-modules (ice-9 syncase))
> 
> (define-syntax include

[...]

There's of course an important detail about the semantics:
If the macro `include' is expanded only once, as in Guile, the file
will be loaded only once. So, if you have a function using `include',
it will load the file on the first call, but not on subsequent.
You can compare `include' to "#include" in C.

There are ways to do it dynamically, but I won't talk about them since
the facilities for doing this might be removed from Guile fairly soon.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]