From: Wei Jen Yeh
Subject: gensym and shell-out
Date: 
Message-ID: <14322@medusa.cs.purdue.edu>
Hello, again.
It's quiz time for you guys again.

Q1.  How would you implement shell-out (to the lisp read-eval-print loop)
     keeping the dynamic environment?
Q2.  Similar to Q1, but with a null environment?

Thanks in advance.

Wei Jen Yeh                      ···@cs.purdue.edu
                                 Department of Computer Science
                                 Purdue University
                                 West Lafayette, Indiana
From: Barry Margolin
Subject: Re: gensym and shell-out
Date: 
Message-ID: <1991Apr14.074842.24233@Think.COM>
In article <·····@medusa.cs.purdue.edu> ···@cs.purdue.EDU (Wei Jen Yeh) writes:
>Hello, again.
>Q1.  How would you implement shell-out (to the lisp read-eval-print loop)
>     keeping the dynamic environment?

There's no portable way to invoke the standard read-eval-print loop.  The
closest you can get portably is the BREAK function, which invokes the
debugger.  In most implementations, the debugger includes a read-eval-print
loop.

You could also write your own read-eval-print loop, it's not that hard.

In either case, the dynamic environment would normally be kept, since you
would still be within the dynamic extent if the place where the
read-eval-print loop was called.  However, on some systems the debugger
binds some special variables; for instance, Genera binds many of the
reader and printer control variables if they have non-default values, to
make sure that you're able to interact with the debugger (in case the
reason for entry into the debugger is an invalid value of one of these
variables).

>Q2.  Similar to Q1, but with a null environment?

I don't know of any way to get a null dynamic environment.  In many
implementations, previous values of dynamic variables are stored in the
execution stack.  The only way to restore variables to their old values is
by unwinding the stack, which would also discard all the execution state.
--
Barry Margolin, Thinking Machines Corp.

······@think.com
{uunet,harvard}!think!barmar