From: Nathan Baum
Subject: Top-level environments as first-class objects
Date: 
Message-ID: <1168223849.176141.261150@38g2000cwa.googlegroups.com>
Talking about making a persistent Lisp in an earlier post made me think
about how best to implement it. The principle issue is what to do when
multiple Lisp sessions are running at the same time: which one
persists? One answer is to say that there can only be one Lisp session,
and if you want to be able to have more than dialog with Lisp at a
time, this implies a "Lisp server" to which many clients connect.

There are all sorts of pitfalls with this scheme, but the primary one
seems to be "what do we do about the top-level environment?" For
example, two different programs might fight over control of the FOO
package, or assign differing values to the printer's global variables.
That wouldn't do.

It seems like first-class top-level environments, as in something where
one could do (something similar to)

  (do-in-environment (make-environment (default-environment)) #'(lambda
() ...)),

with with-environment and with-top-level-environment for syntactic
sugar, would be an ideal solution.

Despite the apparent obviousness of the need, I can't find much on
google about first-class top-level environments. What's the state of
the art in this area?
From: Pascal Costanza
Subject: Re: Top-level environments as first-class objects
Date: 
Message-ID: <50ehfaF1fnrslU1@mid.individual.net>
Nathan Baum wrote:
> Talking about making a persistent Lisp in an earlier post made me think
> about how best to implement it. The principle issue is what to do when
> multiple Lisp sessions are running at the same time: which one
> persists? One answer is to say that there can only be one Lisp session,
> and if you want to be able to have more than dialog with Lisp at a
> time, this implies a "Lisp server" to which many clients connect.
> 
> There are all sorts of pitfalls with this scheme, but the primary one
> seems to be "what do we do about the top-level environment?" For
> example, two different programs might fight over control of the FOO
> package, or assign differing values to the printer's global variables.
> That wouldn't do.
> 
> It seems like first-class top-level environments, as in something where
> one could do (something similar to)
> 
>   (do-in-environment (make-environment (default-environment)) #'(lambda
> () ...)),
> 
> with with-environment and with-top-level-environment for syntactic
> sugar, would be an ideal solution.
> 
> Despite the apparent obviousness of the need, I can't find much on
> google about first-class top-level environments. What's the state of
> the art in this area?

I am not sure, but I think the search term you are looking for is 
"application isolation".


Pascal

-- 
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/