chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] Re: module for srfi-35


From: felix winkelmann
Subject: [Chicken-users] Re: module for srfi-35
Date: Tue, 14 Oct 2008 10:56:11 +0200

On Mon, Oct 13, 2008 at 1:46 PM, Jörg F. Wittenberger
<address@hidden> wrote:
>
> I would rather have used (import (prefix srfi-35 srfi35:)) .  But either
> I did not understand what I should put where I left the ellipsis here or
> this might not work correctly at top level?  Whatever I tried, the top
> level bindings ended up as undefined values (or was it unbound?).

To make the variables available at toplevel (for compiled code),
use (import srfi-35). To make them available in evaluated code,
eval '(import srfi-35) first. This should normally work.
>
> (define foo '(import (prefix srfi-35 srfi:35)))
>
> (define bar '(import (rename srfi-18 (raise issue))))
>
> (define (export-them! lst envt)
>  (fold-import-statements
>  (lambda (param init) (apply environment-extend! init param) init)
>  envt
>  lst))
>
> (define env (make-environment))
>
> (export-them! foo env)
> (export-them! bar env)
>
> Now in "env" "issue" is bound to "raise", SRFI-35 is bound with prefix.

Modules and first-class environments can currently not be combined,
sorry.

>
> Desperately: get an example how to save some typing with rename.
>
> Alternatively: get an idea how to save even more typing using low level
> access.

For value bindings, you can use the "<modulename>#<identifier>" hack,
for syntax, I can not provide an easy way. You mix module code, non-module
code and evaluated code in convoluted ways. There is no lowlevel module-API
yet, and I can't come up with one easily. This all is still under
heavy development.


cheers,
felix




reply via email to

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