guile-user
[Top][All Lists]
Advanced

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

Re: Namespaces for HB-Guile modules? Help. :(


From: Alejandro Forero Cuervo
Subject: Re: Namespaces for HB-Guile modules? Help. :(
Date: Thu, 22 Nov 2001 22:18:35 -0500
User-agent: Mutt/1.2.5i

Thank you very much for your information on safe modules, they seem to
be precisely what I was needing.

I still have a few questions.

How am I supposed to load module (ice-9 safe) from C code?  I tried
with 
    scm_c_use_module("ice-9 safe");
but I got
    ERROR: In procedure car:
    ERROR: Wrong type argument in position 1: ice-9 .
I tried with different strings (such as "safe" and "(ice-9 safe)") but
I could not figure out how to specify the module name to
scm_c_use_module.

I also tried with
    scm_call_1(scm_c_lookup("use-modules"),
               scm_list_2(scm_mem2symbol("ice-9", 5), scm_mem2symbol("safe", 
4)));
but I got
    ERROR: In procedure apply:
    ERROR: Wrong type argument in position 1: #<variable 40274f40 binding: 
#<macro! use-modules>> .

I had to use
    gh_eval_str("(use-modules (ice-9 safe))");
but I'd rather use scm_c_use_module or the appropriate function.

How can I get scm_c_use_module to do the same as
    (use-modules (ice-9 safe)) ?

Another question...

I want to give access to all of the standard Guile functionality in my
newly created module (the reason I'm using safe modules is just to
keep separated namespaces: I do trust the code that I'll execute
inside each module).  Which is the name of the module I need to load?

I thought (ice-9 boot-9) would do (after I checked the code and, for
confirmation, did a strace of the Guile process and found out
ice-9/boot-9.scm was the first .scm file it read) it but I got:

    guile> (use-modules (ice-9 safe))
    guile> (define m (make-safe-module))
    guile> (module-define! m 'use-modules use-modules)
    #f
    guile> (eval '(use-modules (ice-9 boot-9)) m)    
    standard input:4:8: In expression (eval-case (# #) (else #)):
    standard input:4:8: Unbound variable: eval-case
    ABORT: (unbound-variable)

I tried to manually module-define each of the unbound variables until
my eval call would work.  I defined eval-case, process-use-modules,
procedure->memoizing-macro, simple-format and primitive-load-path...
and then, the Guile interpreter seemed to go into an infinite loop
(in my call to eval) until I SIGINTed it to keep it from hogging all
the memory in my system (and on SIGINT it segfaulted, rather than
interrupt my call to eval (if this is a bug I could provide a stack
trace or whatever I can to help)).

I'm obviously doing something wrong, so how can I get the standard
functionality in one of my "safe" newly-created modules?

Thank you very much.

Alejo.
http://bachue.com/alejo

--
The mere formulation of a problem is far more essential than its solution.
      -- Albert Einstein.

$0='!/sfldbi!yjoV0msfQ!sfiupob!utvK'x44;print map{("\e[7m \e[0m",chr ord
(chop$0)-1)[$_].("\n")[++$i%77]}split//,unpack'B*',pack'H*',($F='F'x19).
"F0F3E0607879CC1E0F0F339F3FF399C666733333CCF87F99E6133999999E67CFFCCF3".
"219CC1CCC033E7E660198CCE4E66798303873CCE60F3387$F"#Don't you love Perl?

Attachment: pgpVyxEifk4fQ.pgp
Description: PGP signature


reply via email to

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