[Top][All Lists]

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

Re: set-current-module in .guile ?

From: Ludovic Courtès
Subject: Re: set-current-module in .guile ?
Date: Wed, 09 Apr 2008 17:05:19 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)


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!',


reply via email to

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