Subject: Re: format to nil?
From: rpw3@rpw3.org (Rob Warnock)
Date: Tue, 19 Apr 2005 00:48:25 -0500
Newsgroups: comp.lang.lisp
Message-ID: <KPmdnXEt-NY0BvnfRVn-uw@speakeasy.net>
Raymond Toy  <raymond.toy@ericsson.com> wrote:
+---------------
| >>>>> "Rob" == Rob Warnock <rpw3@rpw3.org> writes:
|     Rob>     (make-two-way-stream (make-concatenated-stream)
|     Rob> 			 (make-broadcast-stream))
| 
|     Rob> p.s. For some reason, CMUCL-19a barfs if you try to write
|     Rob> to such a stream, though writing to this one works fine:
| 
|     Rob>     (make-two-way-stream (make-string-input-stream "")
|     Rob> 			 (make-broadcast-stream))
| 
| This is odd.  The first version above works for me on cmucl-19a on
| sparc, and also works with current CVS versions.
| What platform are you running this on?
+---------------

Fails: 19a on an Athlon-64 in 32-bit mode under Linux 2.4.21-20.EL
(core was "Dumped on: Wed, 2004-07-28 09:51:48-07:00 on lorien")

Fails: 19a-pre3 on a P-4 running Linux 2.4.21-15.EL
(core "Dumped on: Wed, 2004-06-30 13:13:25-04:00 on lorien").

Fails: 19a-pre3 FreeBSD prebuilt (at SRI) binary on an Athlon-XP (FBSD-4.6)
("Dumped on: Fri, 2004-07-02 11:56:53-07:00 on snapdragon.csl.sri.com").

Works fine: 18e FreeBSD binary on an Athlon-XP (FBSD-4.6)
("Dumped on: Thu, 2003-04-03 10:07:59-08:00 on cvs2.cons.org"),

Test case for all the above:

    (let ((s (make-two-way-stream (make-concatenated-stream)
				  (make-broadcast-stream))))
      (dotimes (i 10) (format s "Hello, i = ~a~%" i)))

"Works" simply returns NIL.

"Fails" gives some variant of this:

    Type-error in KERNEL::OBJECT-NOT-TYPE-ERROR-HANDLER:
       NIL is not of type FUNDAMENTAL-STREAM
       [Condition of type TYPE-ERROR]

    Restarts:
      0: [ABORT] Return to Top-Level.

    Debug  (type H for help)

    (LISP::STREAM-MISC-DISPATCH 4 NIL :LINE-LENGTH NIL ...)[:EXTERNAL]
    Source: Error finding source: 
    Error in function DEBUG::GET-FILE-TOP-LEVEL-FORM:  Source file no longer exists:
      target:code/stream.lisp.
    0] back

    0: (LISP::STREAM-MISC-DISPATCH 4 NIL :LINE-LENGTH NIL ...)[:EXTERNAL]
    1: (LISP::TWO-WAY-MISC
	#<Two-Way Stream, Input = #<Concatenated Stream, Streams = NIL>, Output = #<Broadcast Stream>>
	:LINE-LENGTH
	NIL
	NIL)
    2: (PRETTY-PRINT::MAKE-PRETTY-STREAM
	#<Two-Way Stream, Input = #<Concatenated Stream, Streams = NIL>, Output = #<Broadcast Stream>>)
    3: (PRETTY-PRINT::OUTPUT-PRETTY-OBJECT 0
					   #<Two-Way Stream, Input = #<Concatenated Stream, Streams = NIL>, Output = #<Broadcast Stream>>)
    4: (PRINC 0
	      #<Two-Way Stream, Input = #<Concatenated Stream, Streams = NIL>, Output = #<Broadcast Stream>>)
    5: (FORMAT::A-FORMAT-DIRECTIVE-INTERPRETER
	#<Two-Way Stream, Input = #<Concatenated Stream, Streams = NIL>, Output = #<Broadcast Stream>>
	#<~a>
	(#<~%>)
	#<unused-arg>
	...)
    ...[remainder omitted for brevity]...


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607