[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Issue: CLOSE-CONSTRUCTED-STREAMS (not yet submitted)
- To: Kent M Pitman <KMP@STONY-BROOK.SCRC.Symbolics.COM>
- Subject: Re: Issue: CLOSE-CONSTRUCTED-STREAMS (not yet submitted)
- From: masinter.pa@Xerox.COM
- Date: 6 Jan 89 15:40 PST
- Cc: masinter.pa@Xerox.COM, firstname.lastname@example.org
- In-reply-to: Kent M Pitman <KMP@STONY-BROOK.SCRC.Symbolics.COM>'s message of Wed, 14 Dec 88 01:00 EST
References: Close (CLtL p. 332), WITH-OPEN-STREAM
(CLtL p 330), make-synonym-stream, make-broadcast-stream,
Related issues: CLOSED-STREAM-OPERATIONS
Edit history: Masinter, 6-Jan-89, Version 1
First some terminology:
A "composite" stream is one created with make-synonym-stream,
make-broadcast-stream, make-concatenated-stream, make-two-way-stream,
A "constructed" stream is either a composite stream or one created with
The function "CLOSE" is currently described in 21.3, which starts "This
section contains discussion of only those operations that are common to all
streams." This would seem to imply that they apply to constructed streams.
The definition of CLOSE "The argument must be a stream. No further
input/output operations may be performed on it. ... " It further states
"... and it is permissible to close an already closed stream."
However, the behavior on the constructed streams is not well defined, and
implementations (apparently) differ.
It "is an error" to call CLOSE on a constructed stream. CLOSE might signal
an error, or the result of CLOSE could cause the constituent streams to be
closed, etc, but the effect is implementation-dependent.
Calling CLOSE on a constructed stream signals an error.
The effect of CLOSE on a constructed stream is to close the "argument"
stream only, but none of the constituents; that is,
a) no i/o operations are permitted after the call to CLOSE on the stream
given to CLOSE. In addition, for streams created with
make-string-output-stream, the result of get-output-stream-string is
unspecified. For other composite streams, the "links"
b) the call to CLOSE has no effect on other streams:
for broadcast, two-way, synonym or echo streams, none of
the constituent streams are closed (the "links"
to the constituents may be broken; if the proposal
in STREAM-ACCESS passes, the results of
the accessor functions there are unspecified after
the call to CLOSE.)
Signalling an error is reasonable if no Common Lisp program ever needs to
call CLOSE on a composite stream. We could not come up with a legitimate
case where you wouldn't instead close the underlying stream if that's what
Allowing the result to be implementation dependent is the "status quo".
ARGUMENT-STREAM-ONLY is probably the "safest" in that it makes it harder to
accidentally close a stream that wasn't intended.
Envos Medley seems to implement ARGUMENT-STREAM-ONLY.
Cost to Implementors:
Varying, depending on the current level of conformance. Making the changes
themselves is probably trivial (to the "close" method for each kind of
constructed stream type)
Cost to Users:
Likely small; we've not found any good uses for CLOSE on composite streams.
Cost of non-adoption:
Continued minor ambiguity
The language would be more well specified.
Well-specified languages are usually easier to deal with.
We discussed, and there was some sentiment, for another alternative: CLOSE
closes the constituent streams as well. It could be an incompatible change
for some implementations. it makes more sense for things like broadcast
streams (which are usually non-interactive) than it does for echo streams
(which are sometimes interactive).
ARGUMENT-STREAM-ONLY is weird. i can't figure out what i think of it. it
seems counterintuitive and yet it probably wouldn't be harmful if it were
well-defined that this was what it did.