This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Input/output problems with closed ports
| Gary> I'm not entirely convinced, but there's probably no good
| Gary> reason not to add the procedure. You can do it like this
| Gary> anyway:
|
| Gary> (define (closed? port) (let ((str (with-output-to-string
| Gary> (lambda () (write port))))) (string=? (substring str 2 8)
| Gary> "closed")))
|
| It seems to me too dependent on the external representation of ports
| in Guile. I would better go for some encapsulation of a close/open
| state with GOOPS.
I've added it to port.c, to go along with "input-port?" etc. I made
the Scheme name "port-closed?", since it's defined by that name in a
couple of other implementations.