[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: close on synonym streams, etc



I still prefer "it is an error" to close streams not created with OPEN. 

However, if there is strong sentiment to allow CLOSE on pseudo-streams
like broadcast, synonym and the like, it would be the most consistent to
define it as a no-op. That is, closing a synonym stream should have no
effect.

Why?

a) this is certainly the simplest to implement. There's no need to keep
pseudo-state "open" or "closed" on streams that would otherwise not need
them.

b) this would allow the most programs to function, when handed
pseudo-streams instead of file streams. In the example of "a program
that, when encountering end-of-file closes the inpupt stream and
returns" would work when handed a synonym stream to *standard-input*.

c) it is upward compatible-- no current program would stop functioning.

d) those implementations which "cache" some information into buffered
streams could use "close" to mean "flush the cache", although this would
have no effect on the program semantics.