guile-user
[Top][All Lists]
Advanced

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

Re: environments question


From: Paul Jarc
Subject: Re: environments question
Date: Mon, 25 Aug 2003 12:22:10 -0400
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux)

Nic <address@hidden> wrote:
> And I do this in a Guile repl:
>
>   (let ((myenv (interaction-environment)))
>     (eval '((primitive-load "somefile.scm")) myenv)
>     (eval '((apply 'somefunc-defined-in-somefile (list))) env)
>     (somefunc-defined-in-somefile (list)))
>
> Should the second call to somefunc-defined-in-somefile work? It does
> but I was suprised by that. I thought that I had loaded somefile.scm
> in the environment called myenv.

You did.  But myenv is just the normal toplevel environment:
guile> (eq? (current-module) (interaction-environment))
#t

You can create a new module like this:
(make-module 31 `(,(resolve-interface '(guile))))
The magic 31 is the size of a hash table; it should be comparable to
the number of symbols that will be defined in this module.  The
resolve-interface bit means that for any symbol lookups in this new
module, if they are not found in the module itself, they will be
looked up in the standard guile module.


paul




reply via email to

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