Thanks, Loduvic.

I appreciate your effort looking at this.

Scott



________________________________________
From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Ludovic Courtès [EMAIL 
PROTECTED]
Sent: Wednesday, April 09, 2008 11:05 AM
To: [email protected]
Subject: Re: set-current-module in .guile ?

Hi,

I can reproduce the problem now, with Guile 1.8 and SLIB 3a5.

"Scott N. Walck" <[EMAIL PROTECTED]> writes:

> [EMAIL PROTECTED]:~]$ guile
> guile> (load "/usr/local/src/guile-scmutils/src/load.scm")
> guile> (module-use! (current-module) generic-environment)
> #f
> guile> +
> #<procedure g:+ args>
> guile> (+ (vector 5 6) (vector 7 8))
> Segmentation fault (core dumped)

That's because there's a circular reference in the modules:

  guile> (module-uses generic-environment)
  (#<directory (guile-user) b7c35620>)
  guile> (current-module)
  #<directory (guile-user) b7c35620>

IOW, `generic-environment' uses `(guile-user)' (the default module
that's used when one get to the REPL), and the `module-use!' line above
makes `(guile-user)' use `generic-environment'.

Thus, further variable lookups that are not satisfied by either module
are bound to fail: the `module_variable ()' function in `modules.c'
looks for the variable in `(guile-user)', then in `generic-environment',
then in `(guile-user)', and so on.

This should be reported as a `guile-scmutils' bug.  One possibility is
to fix the way `generic-environment' is created in `kernel/genenv.scm'.
Guile-scmutils should really use modules in a more orthodox way rather
than expect users to fiddle with `set-current-module', `module-use!',
etc.

Thanks,
Ludovic.






Reply via email to