#101 closed defect (fixed)
Gray steam non-conformance: not invoking STREAM-CLEAR-OUTPUT and STREAM-ADVANCE-TO-COLUMN
Reported by: | Anton Vodonosov | Owned by: | Raymond Toy |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | Gray-streams | Version: | 2014-05 |
Keywords: | Cc: |
Description
As we can see from the trivial-gray-streams test suite:
http://cl-test-grid.appspot.com/blob?key=eefx5t0o0r https://github.com/trivial-gray-streams/trivial-gray-streams/blob/master/test/test.lisp
CMUCL does not call some generic functions when necessary:
- When we call cl:clear-output for a gray stream, CMUCL calls ext:stream-force-output instead of ext:stream-clear-output
- When we call cl:format with the ~T directive, for example (cl:format a-gray-stream "~10,t"), CMUCL calls ext:stream-line-column and ext:stream-write-string instead of ext:stream-advance-to-column
See the specification: http://www.nhplace.com/kent/CL/Issues/stream-definition-by-user.html
STREAM-ADVANCE-TO-COLUMN stream column [Generic Function]
Writes enough blank space so that the next character will be written at the specified column. Returns true if the operation is successful, or NIL if it is not supported for this stream. This is intended for use by by PPRINT and FORMAT ~T. The default method uses STREAM-LINE-COLUMN and repeated calls to STREAM-WRITE-CHAR with a #\SPACE character; it returns NIL if STREAM-LINE-COLUMN returns NIL.
So, it is better to call ext:stream-advance-to-column, and provide the default implementation for ext:stream-advance-to-column, as specified.
Importance: I am unaware of a library that depend on those Gray protocol details. But it is non-conforming.
Change History (5)
comment:1 Changed 10 years ago by
Component: | Core → Gray-streams |
---|---|
Owner: | changed from somebody to Raymond Toy |
comment:2 Changed 10 years ago by
Priority: | major → minor |
---|
comment:3 Changed 10 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:4 Changed 10 years ago by
I'm not sure, but I think the trivial-gray-streams test for STREAM-ADVANCE-TO-COLUMN
might still fail because the implementation still calls
STREAM-LINE-COLUMN
and STREAM-WRITE-CHAR
.
I did test that (format <gray> "~10T") does call STREAM-ADVANCE-TO-COLUMN
using TRACE
.
comment:5 Changed 10 years ago by
The test will succeed if STREAM-ADVANCE-TO-COLUMN is called, no matter what other methods are called too.
commit e585e8d6acbc146e978d1c2c5171987b6ba2fddf Author: Raymond Toy <toy.raymond@…> Date: Sat Aug 9 23:49:14 2014 -0700