guile-user
[Top][All Lists]
Advanced

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

RE: set-current-module in .guile ?


From: Walck, Scott
Subject: RE: set-current-module in .guile ?
Date: Wed, 9 Apr 2008 11:24:46 -0400

Thanks, Loduvic.

I appreciate your effort looking at this.

Scott



________________________________________
From: address@hidden address@hidden On Behalf Of Ludovic Courtès address@hidden
Sent: Wednesday, April 09, 2008 11:05 AM
To: address@hidden
Subject: Re: set-current-module in .guile ?

Hi,

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

"Scott N. Walck" <address@hidden> writes:

> address@hidden:~]$ 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

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