teskridg@nmsu.edu (Tom Eskridge) (02/13/91)
Thanks to all who responded to my earlier question. The V parameter is of course documented in CLtL I & II. The question now is if it is a known bug in Lucid Allegro CL v3.01 that the V option will not work on file streams. We're have some code where (format t "~VThello" 8) => " hello" and (format outfile "~VThello" 8) => " hello" where the leading spaces are the default produced by ~T so "~Thello" would have produced the same thing. Any explanations? tom eskridge computing research laboratory, new mexico state university teskridg@nmsu.edu (505) 646-6247 -- tom eskridge computing research laboratory, new mexico state university teskridg@nmsu.edu (505) 646-6247
barmar@think.com (Barry Margolin) (02/13/91)
In article <TESKRIDG.91Feb12103007@illyria.nmsu.edu> teskridg@nmsu.edu (Tom Eskridge) writes: >The question now is if it is a known bug in Lucid Allegro CL v3.01 that the V >option will not work on file streams. We're have some code where > (format t "~VThello" 8) => " hello" >and > (format outfile "~VThello" 8) => " hello" where the leading spaces are the >default produced by ~T so "~Thello" would have produced the same thing. Are you sure this problem is related to the V parameter? Does it do the right thing when you use ~8T instead of ~VT? I suspect they both do the same thing (in most implementations, by the time the handler for ~T is called, the origin of the parameter has been forgotten). In many implementations, column positions are only tracked on terminal streams, not file or string streams. The description of ~T specifically supports this; it says that if the output is going to a stream that doesn't maintain column positions it should output the default minimum amount of whitespace. For an example where it is very hard to make ~T do the "right" thing, consider broadcast streams: (setq *outfile* (open "filename" :direction :output)) (setq *broadcast* (make-broadcast-stream *standard-output* *outfile*)) (write-string " " *outfile*) (write-string " " *standard-output*) (format *broadcast* "~8Thello") How many spaces should this output? If it outputs 7, then it will go to column 10 in *standard-output*, but if it outputs 5 then *outfile* will only be at column 6. -- Barry Margolin, Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar