[Top][All Lists]

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

Re: Transient environment with standard functions

From: Taylan Ulrich Bayırlı/Kammer
Subject: Re: Transient environment with standard functions
Date: Sat, 11 Jun 2016 00:11:08 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Basa Centro <address@hidden> writes:

> Matt and List,
> As a matter of fact, I've been thinking about defecting to MIT/GNU
> Scheme if I don't get better support for scmutils and C++ FFI. :)
> Come on now Guilers, we can't have people defecting to Racket.
> Is there equivalent functionality in Guile to Racket's
> make-base-namespace, as Matt needs?  It does seem like Guile's module
> system should handle this.
> Let's help Matt.  Esprit de Guile!
> (Basa)

First of all: is the "sandboxing" aspect of these environment important?

Because Guile uses psyntax so far, which allows "injecting" absolute
references to any binding in any module in the runtime.  For instance,
enter the following into a Guile REPL:

    #(syntax-object proper-list? ((top)) (hygiene srfi srfi-1))

It will return the 'proper-list?' procedure defined in (srfi srfi-1)
even though we didn't import that module!

If that's acceptable, then you can create new environment objects with
'make-module' and add bindings to it with some of the interfaces
explained in: (info "(guile) Module System Reflection")

Equivalent web link:

For instance, the unmerged r7rs-wip branch defines the 'environment'
procedure of R7RS like this:

    (define (environment . import-sets)
      (let ((m (make-module)))
        (module-use-interfaces! m (map resolve-r6rs-interface import-sets))

(Switch to the r7rs-wip branch and see file 'module/scheme/eval.scm'.)

Hope that helps :-)

reply via email to

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