yeh@cs.purdue.EDU (Wei Jen Yeh) (04/14/91)
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 yeh@cs.purdue.edu Department of Computer Science Purdue University West Lafayette, Indiana
barmar@think.com (Barry Margolin) (04/14/91)
In article <14322@medusa.cs.purdue.edu> yeh@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. barmar@think.com {uunet,harvard}!think!barmar