This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: First-class environment proposal


I tried to read the text, but it's 5:30 AM (the time I managed
to finish getting my email after 2 days out) so I'll read it
tomorrow.

But what I'm writing about is an idea I had as soon as I left
home Wednesday. I planned to take these days off to do some
design work on FEAST, and came up with a very interesting idea.
Imagine that you could code this in Guile:

(define top-environment (current-environment))
(define foo (make-environment top-environment))
                            ; the parameters to make-environment
                            ; are all symbols I want it to
                            ; inherit from the current one
(foo (define bar 1))        ; execute (define bar 1) inside foo
(foo bar)                   ; evaluate bar inside foo
=> 1
bar
=> undefined
(define bar 2)              ; not the same bar ;-)
(foo bar)                   ; still 1
=> 1
; now for something advanced
(foo (top-environment bar)) ; read bar from inside the copy of
                            ; top-environment we added to foo
=> 2
(foo (+ bar (top-environment bar)))
=> 3

I just used the word "environment" because that's what's in
discussion; my draft (on paper) used "namespace", and any other
word could be used as well.

I think something like that is absolutely necessary for Guile's
stated goal of emulating other languages; for example, someone
would have a nasty time writing a python->guile translator
without something similar.

Now the questions:

a: Do you guys think this is good? Suggestions to improve it?

b: Do you think the syntax is good? Suggestions to improve it?

c: Can this be done with this "environments" proposal, or be
implemented on top of it?

d: Should I start to work on it?

e: If "d" is #t, can someone send me the copyright assignment I
need to sign? (No boss, all future contributions)

[]s,
                                               |alo
                                               +----
--
      I am Lalo of deB-org. You will be freed.
                 Resistance is futile.

http://www.webcom.com/lalo      mailto:lalo@webcom.com
                 pgp key in the web page

Debian GNU/Linux       --        http://www.debian.org