[slime-devel] What does swank do with streams?

Helmut Eller heller at common-lisp.net
Tue Jun 2 18:35:11 UTC 2009


* mikel evins [2009-06-02 17:31+0200] writes:

> Doubtless this is because we don't properly understand what swank is  
> doing with the streams. I frankly don't know how to frame an  
> intelligent question on this subject, because I don't know enough  
> about what swank is trying to accomplish and how it's going about it.  

Basically SWANK installs a custom stream in *STANDARD-OUTPUT*
and that stream forwards any output to the slime-repl Emacs buffer.
We usually do this with dynamic bindings like

      (let ((*standard-output* <custom-stream>)
            (*standard-input* <custom-stream>)
            (*debug-io* <custom-stream>)
            (*query-io* <custom-stream>)
            (*terminal-io* <custom-stream>))
           ...)

before evaluating code that (potentially) generates output.  We actually
use PROGV but that's a minor detail.

A more problematic feature is "global IO redirection".  This installs
our stream as the truly global value for *STANDARD-OUTPUT* etc.  and
also as the default value for new threads.  The reason to do such a
global thing at all is the desire to redirect the output of threads
created by a HTTP server, or generally threads that are not created by
us.  Global IO redirection is not enabled by default.

> So, what questions should I ask? My goal is to ensure that CCL  
> controls the standard streams in a way it can rely on, while still  
> allowing a swank server to be created and run.

With *globally-redirect-io* enabled you're probably out of luck because
we take over control.  As often in CL, this could be solved by some
convention but there is no established convention.

> If you guys would help me zero in on the right questions to ask you  
> about swank's operation, I'd appreciate it.

Maybe you could think about the HTTP server example and where debug
output of worker threads should go and how to control that.

Helmut.





More information about the slime-devel mailing list