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

*DEBUG-IO*



I didn't realize that the *xxx-IO* variables were documented to contain 
synonym streams. In fact, I wish this had been disallowed.

The reason this came up is that I had an application which wanted to
temporarily use the *DEBUG-IO* for a normal interaction. I thought I
was doing the right thing by doing:
 (LET ((*TERMINAL-IO* *DEBUG-IO*))
   ...)
but in fact I lost completely in 3600 Release 6 Common Lisp because
*DEBUG-IO* had (correctly) contained a synonym stream for 
*TERMINAL-IO* and I ended up with a circular synonym stream in
*TERMINAL-IO*.

At the very least, the manual should contain a mention of this problem
at the top of p329 where it talks about why you shouldn't change
*TERMINAL-IO*.

However, more importantly, we should really have and encourage the
use of a function like the LispM's SI:FOLLOW-SYN-STREAM which 
recursively dereferences a synonym stream and gives you a stream 
that's safe to move around. That way, I could safely write:
 (LET ((*TERMINAL-IO* (FOLLOW-SYNONYM-STREAM *DEBUG-IO*)))
   ...)
and you wouldn't have to have that warning about bindinging *TERMINAL-IO*.

I personally don't see any reason that binding/setting *TERMINAL-IO* 
should be prohibited as long as the thing to which you bind it represents
a valid virtual terminal (whatever that means for the given operating system).
Note that there are no portable operations for creating such a virtual
terminal, but that doesn't mean that portable code shouldn't be able to 
manipulate such objects when it runs across them. In particular, I think
it should be valid to shuffle the synonym-stream-deferenced contents
of *QUERY-IO*, *DEBUG-IO*, and *TERMINAL-IO* back and forth.