?

Log in

No account? Create an account

Synonym streams

Leave me a comment, please:

When was the last time you created a synonym stream? What was it for?

Tags:

Comments

Wow.

i didn't know these even exist. I suppose you could use them to say "wherever standard-output goes, output to this should go", but then, why not use standard-output directly?

(Hm, to answer my own question: If you bind a dynamic variable to a synonym-stream, a user could re-bind that dynamic variable to redirect output to just that stream somewhere. With logging things, this could actually make some sense.)

(Anonymous)

log rotation

By coincidence it was last weekend. For log rotation in a long running server. (But this the the first time ever I'd used synonym streams).

All standard streams were bound to be synonym streams pointing to *log-stream*. Every day or the log rotation code will first rename the old log file, open a new file stream to *log-stream*, and then closes the old logging stream.

- Juho

(Anonymous)

As the default value of a global (defparameter) stream variable.
Never created, but thought about it a couple of times, with the following odd things in mind:
1. After creating a CONCATENATED-STREAM, we can't append or prepend to its CONCATENATED-STREAM-STREAMS, but
2. If we assign it to symbol and use a synonym stream instead, we *can* "append" or "prepend" another stream, by creating a new CONCATENATED-STREAM (possibly including the old one) and replacing a symbol value.

Of course, implementing the same thing on gray streams is slightly more straightforward.
Not yet.

(Anonymous)

Never

I'm pretty sure while writing PCL I understood them just long enough to realize they were almost never what you want.

(Anonymous)

tee

I generally use 'tee' in Unix to save a copy of a stream while I continue processing. I haven't used synonym streams in lisp.

Re: tee