177 lines
11 KiB
HTML
177 lines
11 KiB
HTML
<!-- Common Lisp HyperSpec (TM), version 7.0 generated by Kent M. Pitman on Mon, 11-Apr-2005 2:31am EDT -->
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE>CLHS: Issue BROADCAST-STREAM-RETURN-VALUES Writeup</TITLE>
|
|
<LINK HREF="../Data/clhs.css" REL="stylesheet" TYPE="text/css" />
|
|
<META HTTP-EQUIV="Author" CONTENT="Kent M. Pitman">
|
|
<META HTTP-EQUIV="Organization" CONTENT="LispWorks Ltd.">
|
|
<LINK REL=TOP HREF="../Front/index.htm">
|
|
<LINK REL=COPYRIGHT HREF="../Front/Help.htm#Legal">
|
|
<LINK REL=DISCLAIMER HREF="../Front/Help.htm#Disclaimer">
|
|
<LINK REL=PREV HREF="../Issues/iss020_w.htm">
|
|
<LINK REL=UP HREF="../Issues/iss021.htm">
|
|
<LINK REL=NEXT HREF="../Issues/iss022_w.htm">
|
|
</HEAD>
|
|
<BODY>
|
|
<H1><A REV=MADE HREF="http://www.lispworks.com/"><IMG WIDTH=80 HEIGHT=65 ALT="[LISPWORKS]" SRC="../Graphics/LWSmall.gif" ALIGN=Bottom></A><A REL=TOP HREF="../Front/index.htm"><IMG WIDTH=237 HEIGHT=65 ALT="[Common Lisp HyperSpec (TM)]" SRC="../Graphics/CLHS_Sm.gif" ALIGN=Bottom></A> <A REL=PREV HREF="../Issues/iss020_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss021.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss022_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
<H2>Issue BROADCAST-STREAM-RETURN-VALUES Writeup</H2>
|
|
|
|
<PRE><B>Issue:</B> <A HREF="iss021.htm">BROADCAST-STREAM-RETURN-VALUES</A><P>
|
|
<B>Forum:</B> X3J13 Letter Ballot<P>
|
|
<B>References:</B> <A REL=DEFINITION HREF="../Body/t_broadc.htm#broadcast-stream"><B>BROADCAST-STREAM</B></A> (X3J13/92-102, p21-7)<P>
|
|
<B>Category:</B> CLARIFICATION<P>
|
|
<B>Edit history:</B> 16-Jun-93, Version 1 by Pitman<P>
|
|
17-Jun-93, Version 2 by Loosemore<P>
|
|
(fix bugs, separate incompatible changes)<P>
|
|
<B>Status:</B> Proposal CLARIFY-MINIMALLY passed 9-2 on letter ballot 93/304<P>
|
|
<P>
|
|
<B>Problem Description:<P>
|
|
</B><P>
|
|
The description of the return value for output operations applied <P>
|
|
to broadcast streams doesn't work well for certain kinds of operations,<P>
|
|
<A REL=DEFINITION HREF="../Body/f_stm_el.htm#stream-element-type"><B>STREAM-ELEMENT-TYPE</B></A> being an example.<P>
|
|
<P>
|
|
The zero-argument stream case is important, too, because <P>
|
|
(<A REL=DEFINITION HREF="../Body/f_mk_bro.htm#make-broadcast-stream"><B>MAKE-BROADCAST-STREAM</B></A>)<P>
|
|
is a commonly-used portable way to create a null output stream.<P>
|
|
<P>
|
|
Proposal CLARIFY-MINIMALLY makes explicit the "results from the last <P>
|
|
stream" rule from CLtL, and specifies behavior for the cases where there<P>
|
|
are no streams. Proposal INCOMPATIBLE-CHANGES replaces this rule with<P>
|
|
behavior that makes more sense.<P>
|
|
<P>
|
|
<P>
|
|
<B>Proposal (BROADCAST-STREAM-RETURN-VALUES:CLARIFY-MINIMALLY):<P>
|
|
</B><P>
|
|
<A REL=DEFINITION HREF="../Body/f_stm_el.htm#stream-element-type"><B>STREAM-ELEMENT-TYPE</B></A> returns the value from the last component stream, or<P>
|
|
T if there are no streams.<P>
|
|
<P>
|
|
<A REL=DEFINITION HREF="../Body/f_terpri.htm#fresh-line"><B>FRESH-LINE</B></A> returns the value from the last component stream, or <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A><P>
|
|
if there are no streams.<P>
|
|
<P>
|
|
The following functions return the value from the last component stream,<P>
|
|
or the indicated value if there are no component streams:<P>
|
|
<P>
|
|
<A REL=DEFINITION HREF="../Body/f_file_l.htm#file-length"><B>FILE-LENGTH</B></A> [0]<P>
|
|
<A REL=DEFINITION HREF="../Body/f_file_p.htm#file-position"><B>FILE-POSITION</B></A> [0]<P>
|
|
<A REL=DEFINITION HREF="../Body/f_file_s.htm#file-string-length"><B>FILE-STRING-LENGTH</B></A> [1]<P>
|
|
<A REL=DEFINITION HREF="../Body/f_stm_ex.htm#stream-external-format"><B>STREAM-EXTERNAL-FORMAT</B></A> [:DEFAULT]<P>
|
|
<P>
|
|
<A REL=DEFINITION HREF="../Body/f_stmp.htm#streamp"><B>STREAMP</B></A> and <A REL=DEFINITION HREF="../Body/f_in_stm.htm#output-stream-p"><B>OUTPUT-STREAM-P</B></A> always return true for broadcast streams.<P>
|
|
<A REL=DEFINITION HREF="../Body/f_open_s.htm#open-stream-p"><B>OPEN-STREAM-P</B></A> tests whether the broadcast stream is open, not whether its<P>
|
|
component streams are open. <A REL=DEFINITION HREF="../Body/f_in_stm.htm#input-stream-p"><B>INPUT-STREAM-P</B></A> and <A REL=DEFINITION HREF="../Body/f_intera.htm#interactive-stream-p"><B>INTERACTIVE-STREAM-P</B></A> <P>
|
|
return an implementation-defined <A REL=DEFINITION HREF="../Body/t_ban.htm#boolean"><B>boolean</B></A> value.<P>
|
|
<P>
|
|
For these input operations, the consequences are undefined if the indicated<P>
|
|
operation is performed. (However, implementations that wish to are permitted<P>
|
|
to extend the behavior.)<P>
|
|
<P>
|
|
<A REL=DEFINITION HREF="../Body/f_rd_by.htm#read-byte"><B>READ-BYTE</B></A><P>
|
|
<A REL=DEFINITION HREF="../Body/f_rd_cha.htm#read-char"><B>READ-CHAR</B></A><P>
|
|
<A REL=DEFINITION HREF="../Body/f_rd_c_1.htm#read-char-no-hang"><B>READ-CHAR-NO-HANG</B></A><P>
|
|
<A REL=DEFINITION HREF="../Body/f_peek_c.htm#peek-char"><B>PEEK-CHAR</B></A><P>
|
|
<A REL=DEFINITION HREF="../Body/f_unrd_c.htm#unread-char"><B>UNREAD-CHAR</B></A><P>
|
|
<A REL=DEFINITION HREF="../Body/f_rd_lin.htm#read-line"><B>READ-LINE</B></A><P>
|
|
<A REL=DEFINITION HREF="../Body/f_listen.htm#listen"><B>LISTEN</B></A><P>
|
|
<A REL=DEFINITION HREF="../Body/f_clear_.htm#clear-input"><B>CLEAR-INPUT</B></A><P>
|
|
<P>
|
|
<P>
|
|
<B>Proposal (BROADCAST-STREAM-RETURN-VALUES:INCOMPATIBLE-CHANGES):<P>
|
|
</B><P>
|
|
<A REL=DEFINITION HREF="../Body/f_stm_el.htm#stream-element-type"><B>STREAM-ELEMENT-TYPE</B></A> returns the type-specifier-equivalent of <P>
|
|
`(<A REL=DEFINITION HREF="../Body/a_and.htm#and"><B>AND</B></A> ,x1 ,x2 ...), where each Xi is the result for each component stream.<P>
|
|
<P>
|
|
<A REL=DEFINITION HREF="../Body/f_terpri.htm#fresh-line"><B>FRESH-LINE</B></A> returns the <A REL=DEFINITION HREF="../Body/a_or.htm#or"><B>OR</B></A> of the results for each component stream.<P>
|
|
<P>
|
|
For the following, if the streams are of the same element type and <P>
|
|
individually return the same result, that result is returned. <P>
|
|
Otherwise, the consequences are undefined. (If there are no streams,<P>
|
|
the result shown in brackets is returned.)<P>
|
|
<P>
|
|
<A REL=DEFINITION HREF="../Body/f_file_l.htm#file-length"><B>FILE-LENGTH</B></A> [0]<P>
|
|
<A REL=DEFINITION HREF="../Body/f_file_p.htm#file-position"><B>FILE-POSITION</B></A> [0]<P>
|
|
<A REL=DEFINITION HREF="../Body/f_file_s.htm#file-string-length"><B>FILE-STRING-LENGTH</B></A> [1]<P>
|
|
<A REL=DEFINITION HREF="../Body/f_stm_ex.htm#stream-external-format"><B>STREAM-EXTERNAL-FORMAT</B></A> [:DEFAULT]<P>
|
|
<P>
|
|
<A REL=DEFINITION HREF="../Body/f_stmp.htm#streamp"><B>STREAMP</B></A> and <A REL=DEFINITION HREF="../Body/f_in_stm.htm#output-stream-p"><B>OUTPUT-STREAM-P</B></A> always return true for broadcast streams.<P>
|
|
<A REL=DEFINITION HREF="../Body/f_open_s.htm#open-stream-p"><B>OPEN-STREAM-P</B></A> tests whether the broadcast stream is open, not whether its<P>
|
|
component streams are open. <A REL=DEFINITION HREF="../Body/f_in_stm.htm#input-stream-p"><B>INPUT-STREAM-P</B></A> and <A REL=DEFINITION HREF="../Body/f_intera.htm#interactive-stream-p"><B>INTERACTIVE-STREAM-P</B></A> <P>
|
|
return an implementation-defined <A REL=DEFINITION HREF="../Body/t_ban.htm#boolean"><B>boolean</B></A> value.<P>
|
|
<P>
|
|
For these input operations, the consequences are undefined if the indicated<P>
|
|
operation is performed. (However, implementations that wish to are permitted<P>
|
|
to extend the behavior.)<P>
|
|
<P>
|
|
<A REL=DEFINITION HREF="../Body/f_rd_by.htm#read-byte"><B>READ-BYTE</B></A><P>
|
|
<A REL=DEFINITION HREF="../Body/f_rd_cha.htm#read-char"><B>READ-CHAR</B></A><P>
|
|
<A REL=DEFINITION HREF="../Body/f_rd_c_1.htm#read-char-no-hang"><B>READ-CHAR-NO-HANG</B></A><P>
|
|
<A REL=DEFINITION HREF="../Body/f_peek_c.htm#peek-char"><B>PEEK-CHAR</B></A><P>
|
|
<A REL=DEFINITION HREF="../Body/f_unrd_c.htm#unread-char"><B>UNREAD-CHAR</B></A><P>
|
|
<A REL=DEFINITION HREF="../Body/f_rd_lin.htm#read-line"><B>READ-LINE</B></A><P>
|
|
<A REL=DEFINITION HREF="../Body/f_listen.htm#listen"><B>LISTEN</B></A><P>
|
|
<A REL=DEFINITION HREF="../Body/f_clear_.htm#clear-input"><B>CLEAR-INPUT</B></A><P>
|
|
<P>
|
|
<P>
|
|
<B>Test Case:<P>
|
|
</B><P>
|
|
Not provided.<P>
|
|
<P>
|
|
<B>Rationale:<P>
|
|
</B><P>
|
|
These values <A REL=DEFINITION HREF="../Body/f_provid.htm#provide"><B>provide</B></A> plausible defaults for the cases where there is likely<P>
|
|
to be no controversy, without trying to define the cases in the gray areas.<P>
|
|
<P>
|
|
<B>Current Practice:<P>
|
|
</B><P>
|
|
Not provided.<P>
|
|
<P>
|
|
<B>Cost to Implementors:<P>
|
|
</B><P>
|
|
Probably relatively small.<P>
|
|
<P>
|
|
<B>Cost to Users:<P>
|
|
</B><P>
|
|
None. This change doesn't affect anything already guaranteed to the user.<P>
|
|
<P>
|
|
<B>Cost of Non-Adoption:<P>
|
|
</B><P>
|
|
Broadcast streams are hard to use reliably in many situations.<P>
|
|
<P>
|
|
<B>Benefits:<P>
|
|
</B><P>
|
|
Better program portability.<P>
|
|
<P>
|
|
<B>Editorial Impact:<P>
|
|
</B><P>
|
|
Small. A number of small, localized edits.<P>
|
|
<P>
|
|
<B>Aesthetics:<P>
|
|
</B><P>
|
|
Mostly neutral.<P>
|
|
<P>
|
|
<B>Discussion:<P>
|
|
</B> <P>
|
|
This addresses Barrett comment #12 (First Public Review).<P>
|
|
Pitman thinks it's a good idea to clarify this somehow and is mostly<P>
|
|
happy with the above, but might be satisfied with other variations on<P>
|
|
this theme, as long as they were intuitive, implementable, etc.<P>
|
|
<P>
|
|
Loosemore notes that we have already approved a previous issue<P>
|
|
(<A HREF="iss261_m.htm">PATHNAME-STREAM</A>) to make coercing a broadcast stream to a <A REL=DEFINITION HREF="../Body/a_pn.htm#pathname"><B>pathname</B></A> <P>
|
|
have undefined consequences. Likewise, we have already decided that<P>
|
|
calling <A REL=DEFINITION HREF="../Body/f_close.htm#close"><B>CLOSE</B></A> on a broadcast stream closes only the broadcast stream<P>
|
|
and not its component streams.<P>
|
|
<P>
|
|
</PRE>
|
|
<HR>
|
|
|
|
<A REL=NAVIGATOR HREF="../Front/StartPts.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Starting Points]" SRC="../Graphics/StartPts.gif" ALIGN=Bottom></A><A REL=TOC HREF="../Front/Contents.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Contents]" SRC="../Graphics/Contents.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Master.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Index]" SRC="../Graphics/Index.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Symbol.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Symbols]" SRC="../Graphics/Symbols.gif" ALIGN=Bottom></A><A REL=GLOSSARY HREF="../Body/26_a.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Glossary]" SRC="../Graphics/Glossary.gif" ALIGN=Bottom></A><A HREF="../Front/X3J13Iss.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Issues]" SRC="../Graphics/Issues.gif" ALIGN=Bottom></A><BR>
|
|
|
|
<A REL=COPYRIGHT HREF="../Front/Help.htm#Legal"><I>Copyright 1996-2005, LispWorks Ltd. All rights reserved.</I></A><P>
|
|
</BODY>
|
|
</HTML>
|