[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] REPL with a remote

From: Antti Holvikari
Subject: [Chicken-users] REPL with a remote
Date: Sun, 18 Dec 2011 21:15:05 +0200


I'm building a tool that would allow one to send expressions remotely to a REPL
listening at a UNIX socket (much like SWANK but less emacsy). The client just
sends an expression as a string and the server reads and evals that, and then
sends back the result as a string. I have a working socket server and a client
program that can communicate with the server. The server listens in it's own
thread and does not block the REPL prompt. This works, but doesn't allow me
to, for example, examine the call history of an error caused by evaling an
expression sent from a client. The two are really just two REPLs running at
the same time without sharing much of anything. I'd like to make them more

Here is an example REPL session of what I would like to accomplish (comments
are not part of the REPL session but comments in this email):

% csi -q socket-repl.scm

#;1> (socket-repl-listen!)
Socket REPL listening at /tmp/socket-repl.sock
#;2> (define (square x) (* x x)) ;; sent from a socket client
#;3> (square 2) ;; sent from a socket client
#;4> (square 3) ;; typed in the REPL
#;5> (/ 1 0)    ;; sent from a socket client

Error: (/) division by zero

Call history:

<syntax>          (/ 1 0)
<eval>    (/ 1 0)       <--
#;6> ,c         ;; typed in the REPL
1:     <syntax>          (/ 1 0)
*0:    <eval>    (/ 1 0)

The most important thing is to be able to examine the call history of any
expression whether it's typed in the REPL itself or sent from a
client, and share
the same environment so that the same bindings are available in both the REPL
itself and in code sent from a client.

I looked into csi.scm but it seems much of it is kept private in the module.

Any guidance would be much appreciated.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]