unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: guile-user@gnu.org
Subject: Re: set-current-module in .guile ?
Date: Wed, 09 Apr 2008 17:05:19 +0200	[thread overview]
Message-ID: <87lk3nhxw0.fsf@gnu.org> (raw)
In-Reply-To: 18426.14519.36960.278300@entangle.lvc.edu

Hi,

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

"Scott N. Walck" <walck@lvc.edu> writes:

> [walck@entangle:~]$ 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.





  parent reply	other threads:[~2008-04-09 15:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-05 17:24 set-current-module in .guile ? Scott N. Walck
2008-04-05 21:00 ` Jon Wilson
2008-04-06  0:01   ` Walck, Scott
2008-04-06 14:58     ` Ludovic Courtès
2008-04-07  1:27       ` Walck, Scott
2008-04-07  7:16         ` Ludovic Courtès
2008-04-07 11:27           ` Walck, Scott
2008-04-07 13:38             ` Ludovic Courtès
2008-04-07 15:07               ` Scott N. Walck
2008-04-08 13:40                 ` Ludovic Courtès
2008-04-08 15:41                   ` Scott N. Walck
2008-04-09 15:05                 ` Ludovic Courtès [this message]
2008-04-09 15:24                   ` Walck, Scott
2008-04-09 20:16 ` Neil Jerram

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lk3nhxw0.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).