scsh-users
[Top] [All Lists]

Re: Nested call-with-xxxput-file

To: Rolf-Thomas Happe <rthappe@balrog.mathematik.uni-freiburg.de>
Subject: Re: Nested call-with-xxxput-file
From: sperber@informatik.uni-tuebingen.de (Michael Sperber [Mr. Preprocessor])
Date: 03 Oct 2000 14:56:46 +0200
Cc: scsh-bugs@zurich.ai.mit.edu
Sender: sperber@informatik.uni-tuebingen.de
>>>>> "rth" == Rolf-Thomas Happe <rthappe@balrog.mathematik.uni-freiburg.de> 
>>>>> writes:

rth> I would think that the two pieces of code below are (roughly)
rth> equivalent.  However, scsh (0.5.2 / IRIX 6.5) executes the second
rth> but fails on the first.

rth>     (call-with-input-file "walt.foo"
rth>       (call-with-output-file "walt.bar"
rth>    (lambda (op)
rth>      (lambda (ip)
rth>        (display (read ip) op)))))

Failure of this code is to be expected: CALL-WITH-OUTPUT-FILE closes
the port just prior to returning.  Thus, the (LAMBDA (IP) ...) thunk
tries to write to a dead port.

-- 
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla

<Prev in Thread] Current Thread [Next in Thread>