[Top][All Lists]

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

Re: dynamic module creation

From: Julian Graham
Subject: Re: dynamic module creation
Date: Sun, 1 Feb 2009 15:59:18 -0500

Hi Andy,

> guile> (resolve-module '(foo))
> $1 = #<directory (foo) b7f11bb0>
> guile> (beautify-user-module! $1)
> $2 = (#<interface (guile) b7f8aef0>)
> guile> (module-ref $1 'sin)
> $3 = #<procedure sin (z)>
> guile>

`beautify-user-module!' is great and all, but it doesn't give me any
options about what to import -- it takes everything from
`the-scm-module' and puts it into my module.  Let's say,
hypothetically, that I were interested in creating an environment in
which only some core R5RS / R6RS syntactic forms were available (e.g.,
`if', `cond', etc.) -- is there a way I could do that?

Incidentally, my naive attempt to refine the behavior of
`beautify-user-module!' straight-up failed:

guile> (define m (resolve-module '(foo)))
guile> (let ((interface (make-module 31)))
... (set-module-name! interface (module-name m))
... (set-module-kind! interface 'interface)
... (set-module-public-interface! m interface))
guile> (set-module-uses! m '((guile) :select (if)))
((guile) :select (if))
guile> (set-current-module m)
#<directory (guile-user) b7d61630>
guile> if
Segmentation fault


reply via email to

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