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

Issue: STREAM-CLASS-ACCESS



(This issue was called FOLLOW-SYNONYM-STREAM in the original message by
KMP).

I vaguely remember this being discussed before but cannot find the mail.
I would prefer an extension for accessing the constructed streams that
treated them as if they were constructed by DEFSTRUCT or DEFCLASS, viz:

 As if: (defstruct (synonym-stream (:constructor (make-synonym-stream
(symbol))) symbol)
 => (make-synonym-stream symbol) as in CLtL
       (synonym-stream-p object)
       (synonym-stream-symbol synonym-stream)



As if: (defstruct (broadcast-stream (:constructor (make-broadcast-stream
(&rest streams))) streams)
=> (make-broadcast-stream &rest streams) is in CLtL
       (broadcast-stream-p object)
       (broadcast-stream-streams broadcast-stream)

As if: (defstruct  (two-way-stream (:constructor (make-two-way-stream
(input-stream output-stream))
     => (make-two-way-stream input-stream output-stream) 
          (two-way-stream-p object)
         (two-way-stream-input-stream two-way-stream)
         (two-way-stream-output-stream two-way-stream)

(The reason that I think I remember previous mail is that I remember a
discussion of whether it should be input-stream output-stream or just
input and output to shorten the names two-way-stream-input and
two-way-stream-output.)

(defun follow-synonym-stream (stream)
   (if (synonym-stream-p stream)
    (follow-synonym-stream (symbol-value (synonym-stream-symbol
stream)))
    stream))