guile-devel
[Top][All Lists]
Advanced

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

Re: set-current-module broken in current Guile CVS version (anyone?)


From: Matthias Koeppe
Subject: Re: set-current-module broken in current Guile CVS version (anyone?)
Date: 05 Feb 2001 12:54:10 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.6

Dirk Herrmann <address@hidden> writes:

> On 27 Dec 2000, Matthias Koeppe wrote (to bug-guile):
> 
> > Some of the Guile changes since 2000-12-13 broke
> > `set-current-module'.
> > 
> > guile> (define-module (guile-ilisp))
> > #<directory (guile-ilisp) 8082e70>
> > guile> (define-module (guile-user))
> > #<directory (guile-user) 8082a70>
> > guile> (set-current-module (resolve-module '(guile-ilisp)))
> > guile> (current-module)
> > #<directory (guile-user) 8082a70> ; should be guile-ilisp
> 
> I can at least present you an intermediate solution that will allow you to
> work interactively with modules.  If you want to switch to a different
> module at the guile prompt, you can to the following:
> 
> guile> (begin (define-module (foo)) (scm-style-repl))
> 
> After that, foo will be the current module.  However, this way you have
> actually started a repl within the repl.  [...]

Thanks Dirk but this won't help.  I consider the module system to be
completely broken.  Look at this example where I don't even back out
to the repl and still everything is wrong:

guile> (begin (define-module (xyzzy)) (define xyz 3456) (define-public (def) 
xyz))
guile> xyz
3456
guile> (use-modules (xyzzy))
guile> def
#<procedure def ()>
guile> (def)
standard input:6:1: In procedure def in expression (def):
standard input:6:1: Unbound variable: xyz
ABORT: (unbound-variable)

The first line was supposed to put a private definition of `xyz' in
the (xyzzy) module. It ended up in (guile-user) though.  `def' ended
up in (xyzzy), so its body can't see the `xyz' binding.

I don't really understand the module system but this behaviour is
simply broken. For me this means that Guile has become non-interactive
-- I can no longer change code reliably in run-time. I still have to
run Guile in the 2000-12-07 CVS version, which works as one expects.

I also don't really understand why the 2000-12-15 change (which I
believe caused the problems) fixed the bug I reported regarding
`export' via `eval', like this:

guile> (define-module (murks))
#<directory (murks) 40222d38>
guile> (define-module (guile-user))
#<directory (guile-user) 401f6db0>
guile> (eval-in-module '(define x 1) (resolve-module '(murks)))
guile> x
ERROR: Unbound variable: x        ; right
guile> (eval-in-module '(export x) (resolve-module '(murks)))
guile> x
#f                                ; in Guile 1.4 (wrong)
ERROR: Unbound variable           ; in CVS Guile (right)
guile> (use-modules (murks))
guile> x
#f                                ; in Guile 1.4 (wrong)
1                                 ; in CVS Guile (right)

In any case, the change broke more than it fixed.  

Any ideas how we can fix it properly, anybody?

-- 
Matthias Köppe -- http://www.math.uni-magdeburg.de/~mkoeppe



reply via email to

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