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

Issue: STREAM-INFO (Version 4)

    "Returns the current horizontal position of the cursor..."

    The word "cursor" is unfortunately overused and not defined here or
    elsewhere in CLtL.

Cursor is indeed a vague word.  Perhaps we could just say THAT
"OUTPUT-POSITION returns the total net width of all of the
characters written to the stream since that last <newline> character
(or since the creation of the stream if no <newlines> have ever been

    What is (with-output-to-string (x) (princ "a test") (output-position x))?
    Is it implementation dependent?

There is really a key point here.  Yes it is implementation dependent.
In particular, the values returned cannot be used for anything but
comparing with each other.  For example, if the output-width is not
nil, then the value of output-position can be compared with it to
determine how close you are to the end of the line (in percent, but
not by any absolute measure.)  [With a string-stream the logical
output-width is assumedly nil.]

Another use of output-position is that no matter what number
output-position returns, sending a <newline> to the stream and then
calling output-space with the same number will get you back to the
same horizontal place.

The proposal is carefully crafted to give you these two capabilities
while adding as few other constraints as possible.


NOTE, a broadcast stream must keep track of the relationships between
the units of width used by the actual target streams so that
output-space requests can be translated correctly when they are
broadcast to all of the actual targets.