guile-user
[Top][All Lists]
Advanced

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

Re: environments


From: Ian Zimmerman
Subject: Re: environments
Date: 23 Mar 2004 17:21:50 -0800
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

I wrote:

Ian> guile> (use-modules (ice-9 r5rs))
Ian> guile> (define e (null-environment 5))
Ian> guile> (environment? e)
Ian> #f
Ian> guile> 
Ian> 
Ian> Comments?

Marius> There are two kinds of environments in Guile.  No no, three,
Marius> there are three types of environment in Guile.  The one that is
Marius> tested for by 'environment?' is not used.  It should probably be
Marius> removed or deactivated.

Marius> (There was a plan to use the unused kind of environments as the
Marius> underlying data type for implementing the module system.  The
Marius> other two kinds of environments are the data structures used to
Marius> implement the 'lexical' environment in the interpreter (very low
Marius> level) and the modules, which might also be called top-level
Marius> environments.)

So, how can I get an object (an environment, module, or whatever) that:

1/ can be used as an argument to @code{eval}

2/ can be enriched with new bindings on the fly

I am looking at mzscheme, it has "namespaces" that seem to fit the bill
exactly.  What I hope to do is something like:

(define foo 1)
; how to implement make-env?  with resolve-module, current-module, ..?
(define e (make-env)) 
(eval '(define foo 2) e)
foo
=> 1
(eval 'foo e)
=> 2

-- 
Nothing can be explained to a stone.
Or to a stoned person, either.




reply via email to

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