[pro] How to interact with a running lisp instance?

Sam Steingold sds at gnu.org
Fri Dec 17 15:33:50 UTC 2010


On Thu, Dec 16, 2010 at 12:25 PM, Steve Morin <steve.morin at gmail.com> wrote:
> How to interact with a running lisp instance?  I have been trying to figure
> this out.  I know this is being done with slime.  Does any one have any good
> pointer on this.  I am thinking of writing a web application and would like
> to be able to update it on the fly for updates and bug fixes.

The best generic answer is probably the following:
if you have started something  at the REPL, you can interrupt the
process (Ctrl-C or something like that)
and bet a "break" prompt, from which you can do everything you can do
from the regular prompt: load/compile files,
define functions, fix bugs &c &c &c.
Then you should be able to continue the process you just interrupted.

A less generic answer would be to start an extra thread which would be
listening on a port and then you can connect to that port to get a
lisp prompt without interrupting all the other processes currently
running.
Then you can do everything (load/compile files, define functions, fix
bugs &c &c &c) and the lisp should be able to figure out which
processes have to be stopped for which actions (e.g., a process using
CLOS might have to be stopped while low-level MOP stuff is redefined).
You (and the lisp implementors) have to be careful, of course, about
the safe points when things can be interrupted and watch out for the
little things like if you interrupt lisp inside a recursive function F
and redefine F, or if you redefine F by connecting to a separate
thread, then you don't know whether the recursive calls to F will be
using the new or the old definition of F unless you disassemble the
old definition of F and find out whether the recursive call is
compiled as a jump (old definition will be used) or as a (FUNCALL #'F)
(also old definition) or as a (FUNCALL 'F) (new definition will be
used).


-- 
Sam Steingold <http://sds.podval.org>




More information about the pro mailing list