stream-element-type unset within pprint-logical-block

Bug #800010 reported by Mark Cox
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Triaged
Low
Unassigned

Bug Description

The value of STREAM-ELEMENT-TYPE changes within a PPRINT-LOGICAL-BLOCK

(format t "~&Before: ~A~%" (stream-element-type *standard-output*))
(pprint-logical-block (*standard-output* nil)
  (format t "~&Logical Block: ~A~%" (stream-element-type *standard-output*)))

For the above code, SBCL 1.0.48.35 produces

Before: CHARACTER

Logical Block: NIL

Changed in sbcl:
importance: Undecided → Low
status: New → Triaged
tags: added: printer streams
tags: added: easy
Revision history for this message
Matthias Benkard (mulk) wrote :

The reason is that a PRETTY-STREAM is an ANSI-STREAM, so STREAM-ELEMENT-TYPE delegates to the ANSI-STREAM-MISC of the stream, which is SB-PRETTY::PRETTY-MISC for PRETTY-STREAMs. PRETTY-MISC returns NIL for (EQ OP :ELEMENT-TYPE). This is the definition:

(defun pretty-misc (stream op &optional arg1 arg2)
  (declare (ignore stream op arg1 arg2)))

I'm not sure what the fix should look like. Maybe something like this?

(defun pretty-misc (stream op &optional arg1 arg2)
  (declare (ignore arg1 arg2))
  (case op
    ((:element-type) (stream-element-type (pretty-stream-target stream)))))

Are there other -MISC features that PRETTY-STREAMs should hand through to the target stream?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.