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: gh_lookup no longer works??


Mikael Djurfeldt <mdj@mdj-pc.nada.kth.se> 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)
>  (tst)
>
>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)
guile> (tst)
ERROR: In expression (tst):
ERROR: Unbound variable: tst
ABORT: (misc-error)
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?

Steven

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