* environments
@ 2004-03-23 18:55 Ian Zimmerman
2004-03-24 0:26 ` environments Marius Vollmer
0 siblings, 1 reply; 6+ messages in thread
From: Ian Zimmerman @ 2004-03-23 18:55 UTC (permalink / raw)
guile> (use-modules (ice-9 r5rs))
guile> (define e (null-environment 5))
guile> (environment? e)
#f
guile>
Comments?
--
Nothing can be explained to a stone.
Or to a stoned person, either.
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: environments
2004-03-23 18:55 environments Ian Zimmerman
@ 2004-03-24 0:26 ` Marius Vollmer
2004-03-24 1:21 ` environments Ian Zimmerman
0 siblings, 1 reply; 6+ messages in thread
From: Marius Vollmer @ 2004-03-24 0:26 UTC (permalink / raw)
Cc: guile-user
Ian Zimmerman <itz@buug.org> writes:
> guile> (use-modules (ice-9 r5rs))
> guile> (define e (null-environment 5))
> guile> (environment? e)
> #f
> guile>
>
> Comments?
There are two kinds of environments in Guile. No no, three, there are
three types of environment in Guile. The one that is tested for by
'environment?' is not used. It should probably be removed or
deactivated.
(There was a plan to use the unused kind of environments as the
underlying data type for implementing the module system. The other
two kinds of environments are the data structures used to implement
the 'lexical' environment in the interpreter (very low level) and the
modules, which might also be called top-level environments.)
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: environments
2004-03-24 0:26 ` environments Marius Vollmer
@ 2004-03-24 1:21 ` Ian Zimmerman
2004-03-24 15:06 ` environments Paul Jarc
0 siblings, 1 reply; 6+ messages in thread
From: Ian Zimmerman @ 2004-03-24 1:21 UTC (permalink / raw)
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.
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: environments
2004-03-24 1:21 ` environments Ian Zimmerman
@ 2004-03-24 15:06 ` Paul Jarc
2004-03-24 17:39 ` environments Ian Zimmerman
0 siblings, 1 reply; 6+ messages in thread
From: Paul Jarc @ 2004-03-24 15:06 UTC (permalink / raw)
Cc: guile-user
Ian Zimmerman <itz@buug.org> wrote:
> ; how to implement make-env? with resolve-module, current-module, ..?
> (define e (make-env))
(define e (make-module 31 (list (resolve-module '(guile)))))
The 31 specifies the initial size of the hash table used for symbols.
After that is a list of modules (just one, in this case) - if you try
to look up a symbol in e and it isn't there, guile will fall back to
those other modules.
paul
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: environments
2004-03-24 15:06 ` environments Paul Jarc
@ 2004-03-24 17:39 ` Ian Zimmerman
0 siblings, 0 replies; 6+ messages in thread
From: Ian Zimmerman @ 2004-03-24 17:39 UTC (permalink / raw)
Ian> ; how to implement make-env? with resolve-module, current-module, ..?
Ian> (define e (make-env))
Paul> (define e (make-module 31 (list (resolve-module '(guile)))))
Paul> The 31 specifies the initial size of the hash table used for symbols.
Paul> After that is a list of modules (just one, in this case) - if you try
Paul> to look up a symbol in e and it isn't there, guile will fall back to
Paul> those other modules.
Perfect ;-) Thanks very much!
--
Nothing can be explained to a stone.
Or to a stoned person, either.
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 6+ messages in thread
* Environments
@ 2012-12-03 15:24 Sjoerd van Leent Privé
0 siblings, 0 replies; 6+ messages in thread
From: Sjoerd van Leent Privé @ 2012-12-03 15:24 UTC (permalink / raw)
To: guile-user
[-- Attachment #1: Type: text/plain, Size: 1033 bytes --]
Hi Everyone,
What I like to do is to let the user give a "driver" library and pass
that "driver" library around which implements a certain procedure. Using
the eval procedure together with a small instruction and a ad-hoc
generated environment would let the software be pretty free of things
flying around with ill side-effects. Anyone an idea how I could do this
in a portable way?
I have been trying to do this using the construct (environment,
/import-spec/), however, this doesn't appear to include the default
things which the "guile" library provides (such as quote, unquote,
quasiquote and the likes). When using the (scheme-report-enviroment 5),
it appears not to be possible to pass along additional import-spec elements.
I know it is possible to pass "guile" along, however, this is not very
elegant in portability.
Also, I would like the environment to be destroyed afterwards (as I
don't want the environment to leak unwanted side-effects).
Anyone an idea about how to do this?
Thanks in advance,
Sjoerd
[-- Attachment #2: Type: text/html, Size: 1355 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-12-03 15:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-23 18:55 environments Ian Zimmerman
2004-03-24 0:26 ` environments Marius Vollmer
2004-03-24 1:21 ` environments Ian Zimmerman
2004-03-24 15:06 ` environments Paul Jarc
2004-03-24 17:39 ` environments Ian Zimmerman
-- strict thread matches above, loose matches on Subject: below --
2012-12-03 15:24 Environments Sjoerd van Leent Privé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).