guile-user
[Top][All Lists]
Advanced

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

Re: bug: defining things in different threads


From: Linas Vepstas
Subject: Re: bug: defining things in different threads
Date: Thu, 20 Nov 2008 17:23:12 -0600

2008/11/15 Neil Jerram <address@hidden>:
> 2008/11/12 Linas Vepstas <address@hidden>:
>
>> Yes, of course, the problem remains.
>
> Explanation:
>
> Thread 1 is the first thread that does any Guile stuff, so it loads
> boot-9.scm, which means that it ends up in the (guile-user) module.
>
> Thread 2 hasn't done any (set-current-module ...), so it stays at the
> default, which is (guile).
>
> Solution: add (define-module (guile-user)) to the code that you
> execute in thread 2.

This won't actually work, for some reason or another.
Once I am in the second, third, etc. thread, then I cannot
set the current module to be guile-user.  So, for example:

scm-interp> (current-module)
#<module (guile) f5e93e80>
scm-interp> (define-module (guile-user))
#<directory (guile-user) f5e96600>
scm-interp>  (current-module)
#<module (guile) f5e93e80>
scm-interp> (set-current-module (define-module (guile-user)))
#<directory (guile-user) f5e96600>
scm-interp>  (current-module)
#<module (guile) f5e93e80>

Here, scm-interp is my shell, which just calls
scm_c_eval() from C code.

What's worse, I seem to not be able to use modules
when I'm in this mode.  I can reproduce this behaviour
from the standard command line client. So for example,
list-index is defined in boot-9, but I want the one in srfi-1.
They don't work alike; the boot-9 one complains about
something when fed an example from srfi-1:


address@hidden: /usr/share/guile/1.8/srfi $ guile
guile>  (list-index even? '(3 1 4 1 5 9))
ERROR: Wrong type (expecting pair): #<primitive-procedure even?>
ABORT: (wrong-type-arg)
guile>  (use-modules (srfi srfi-1))
guile> (list-index even? '(3 1 4 1 5 9))
2
guile>  (current-module)
#<directory (guile-user) f7c48600>
guile>  (define-module (guile))
#<module (guile) f7c45e80>
guile> (current-module)
#<module (guile) f7c45e80>
guile> (list-index even? '(3 1 4 1 5 9))
ERROR: Wrong type (expecting pair): #<primitive-procedure even?>
ABORT: (wrong-type-arg)
guile>  (use-modules (srfi srfi-1))
guile> (list-index even? '(3 1 4 1 5 9))
ERROR: Wrong type (expecting pair): #<primitive-procedure even?>
ABORT: (wrong-type-arg)
guile>

So apparently, it seems that I can't do a (use-modules)
and have it stick, when I'm not in guile-user. What's worse,
when I'm in any thread other than the first thread, I cannot
get to guile-user.  Which means that, no matter what,
I cannot use srfi-1; there seems to be no workaround for this.

--linas




reply via email to

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