Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!think.com!barmar From: barmar@think.com (Barry Margolin) Newsgroups: comp.lang.lisp Subject: Re: V in format statements - another question Message-ID: <1991Feb13.043127.18891@Think.COM> Date: 13 Feb 91 04:31:27 GMT References: Sender: news@Think.COM Distribution: comp.lang.lisp Organization: Thinking Machines Corporation, Cambridge MA, USA Lines: 37 In article 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