[gambit-list] Flushing not done ?

Adrien Pierard pierarda at iro.umontreal.ca
Thu May 31 18:26:25 EDT 2007


Hello !

I've been writing some code today, dumping data in files on the hard
disk. I knew that gambit, and many (if not all) languages buffers data
before enventually writing it to the disk. What puzzled me today, is
that it actually never got written !

Here is the code :

(let ((o (open-output-file "/tmp/flushed-data")))
  (display "whirl" o)
  (display "\n" o))

I thought that when the gambit process cleanly finishes, it would flush
the port, though it didn't.
I had to append a (close-output-port o) in order to have my data dumped.

So, is that an undocumented feature, do I have to do the display in
the IO monad ? Or is it just fully compliant with the "do what you want
with the little constraint in the RnRS" ?

This behaviours happens as well with interpreted code as woth compiled
code. Isn't the OS (or the libc behind gambit) supposed to flush when
the process terminates ?

Should I stick to CALL-WITH-OUPUT-FILE or always close ports ?


Adrien

-- 
" am not a Church numeral; I am a free variable!"
(The Scheme Underground)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20070531/673a7e02/attachment.sig>


More information about the Gambit-list mailing list