Nikodemus Siivola wrote:
> Something like this may be of use:
>
> (defgeneric stream-file-stream (stream &optional direction))
>
> (defmethod stream-file-stream ((stream file-stream) &optional direction)
> (declare (ignore direction))
> stream)
>
> (defmethod stream-file-stream ((stream synonym-stream) &optional direction)
> (declare (ignore direction))
> (stream-file-stream (symbol-value (synonym-stream-symbol stream))))
>
> (defmethod stream-file-stream ((stream two-way-stream) &optional direction)
> (stream-file-stream
> (case direction
> (:input (two-way-stream-input-stream stream))
> (:output (two-way-stream-output-stream stream))
> (otherwise
> (error "Cannot handle a TWO-WAY-STREAM without a valid direction: ~S"
> direction)))))
Thanks. Not sure if it is a bug or not, but when I use this, I get a
compiler note when the function is called (that is, not when I compile
my program; really at run-time).
The note is the following:
; in:
; LAMBDA (#:G2046 #:G2047 #:G2048 #:G2049 #:G2050 #:G2051 #:G2052 #:G2053
; #:G2058 #:G2059)
; (IF (TYPEP SB-PCL::.ARG0. 'TWO-WAY-STREAM) #:G2046 #:G2047)
;
; note: deleting unreachable code
; (Typep Sb-Pcl::.Arg0. 'Two-Way-Stream)
; --> SB-C::%INSTANCE-TYPEP
; ==>
; SB-PCL::.ARG0.
;
; note: deleting unreachable code
;
; compilation unit finished
; printed 2 notes
Funny thing is, if I change the order in which the methods are
defined, I still get the note but the line
; (Typep Sb-Pcl::.Arg0. 'Two-Way-Stream)
will change, reflecting the new method order (the type part).
I can muffle the compiler note, but this feels weird to me, so I thought
I'd report it anyway.
--
Resistance is futile. You will be jazzimilated.
Scientific site: http://www.lrde.epita.fr/~didier
Music (Jazz) site: http://www.didierverna.com
EPITA/LRDE, 14-16 rue Voltaire, 94276 Le Kremlin-Bicêtre, France
Tel. +33 (0)1 44 08 01 85 Fax. +33 (0)1 53 14 59 22
|