guile-devel
[Top][All Lists]
Advanced

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

Argh! Module system frustration.


From: Han-Wen Nienhuys
Subject: Argh! Module system frustration.
Date: Sun, 4 Nov 2001 19:18:28 +0100

X-Mailer: VM 6.96 under Emacs 20.7.1
Reply-To: address@hidden
FCC: ~/persoonlijk/Mail/sent




>From the manual

        The new primitives that you add to Guile with
        `gh_new_procedure' or
        with any of the other mechanisms are normally placed into the
        same
        module as all the other builtin procedures (like `display').
        However,
        it is also possible to put new primitives into their own
        module.

Apart from the outdated reference to gh_new_procedure, this is wrong.
boot-9.scm drops you into the guile-user module, while builtins are in
the guile module.

I suggest that this be documented more prominently, I spent more than
1.5 hours figuring oupt why the attached program didn't work. Also
note that the scheme code (in vain) tries to import the guile and
guile-user modules.  Finally, I'd suggest that the chapter containing
the above doc snippet be linked from "Modules" section.

One final nitpick: it would be nice to have docstrings for the
procedures in ice-9; specifically, all the glorious comments in
ice-9/boot-9.scm are not available from the internal help facilities.
Is there some kind of reason for that, or can I submit a patch?


/*
 gcc -Wall -c -I ~/usr/pkg/guile-1.5.4/include/
 -L~/usr/pkg/guile-1.5.4/include         test.cc ; gcc -Wall -o test
 -L/home/hanwen/usr/pkg/guile-1.5.4/lib/         test.o -lguile
 */

#include <guile/gh.h>
#include <stdio.h>

SCM
foobar ()
{
  printf ("foo");
  return SCM_UNSPECIFIED;
}

static void
inner_main (void *closure, int argc, char **argv)
{
  scm_c_define_gsubr ("foobar", 0,0,0, (SCM (*)()) foobar);

  gh_eval_str ("
(display foobar)
(foobar)
(display assoc)

(define-module (voos)
  :export (testje)
)
(use-modules (guile) (guile-user))
(display assoc)
(foobar)
(display foobar)
(define (testje x) x)


");
  exit(0);
}

int
main (int argc, char **argv)
{
  scm_boot_guile (argc, argv, inner_main, 0);
  return 0; /* never reached */
}






-- 

Han-Wen Nienhuys   |   address@hidden    | http://www.cs.uu.nl/~hanwen/




reply via email to

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