This is the mail archive of the
mailing list for the Guile project.
Re: gh_lookup no longer works??
- To: firstname.lastname@example.org
- Subject: Re: gh_lookup no longer works??
- From: email@example.com (Steven G. Johnson)
- Date: Sun, 29 Aug 1999 18:28:15 -0400
Mikael Djurfeldt <firstname.lastname@example.org> wrote:
>The problem is that gh_lookup looks up variables in the root module
>(guile), while gh_eval_str evaluates strings in the module selected as
>"current" by the repl.
Ah, I see; I didn't realize that there were (guile) and (guile-user)
modules without you doing anything.
>So, if you, in your test program, do:
> (define-module (guile))
> (define foo 1)
>the two behaviours will coincide, and gh_lookup will find the symbol.
Nope, this doesn't work:
guile> (define-module (guile))
#<module the-root-module 296d8920>
guile> (define foo 1)
ERROR: In expression (tst):
ERROR: Unbound variable: tst
Type "(backtrace)" to get more information.
Apparently, "tst" (defined by calling gh_new_procedure in the C program),
is now defined in the wrong module?
Is it just me, or is there something seriously wrong about this? I would
think that, unless the user/programmer specifies otherwise, both the
program code (including all gh_* calls) and any code executed by the user
should execute in the same module context. Why should you have to bend
over backwards to share data and subroutines between the program and the
user--isn't this what Guile was intended for in the first place?
Is this planned to be fixed in the new module system?