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