129 lines
7.9 KiB
HTML
129 lines
7.9 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 WITH-OPEN-FILE-STREAM-EXTENT 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/iss362_w.htm">
|
|
<LINK REL=UP HREF="../Issues/iss363.htm">
|
|
<LINK REL=NEXT HREF="../Issues/iss364_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/iss362_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss363.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss364_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
<H2>Issue WITH-OPEN-FILE-STREAM-EXTENT Writeup</H2>
|
|
|
|
<PRE><B>Issue:</B> <A HREF="iss363.htm">WITH-OPEN-FILE-STREAM-EXTENT</A><P>
|
|
<B>References:</B> <A REL=DEFINITION HREF="../Body/m_w_open.htm#with-open-file"><B>WITH-OPEN-FILE</B></A><P>
|
|
<A REL=DEFINITION HREF="../Body/m_w_op_1.htm#with-open-stream"><B>WITH-OPEN-STREAM</B></A><P>
|
|
<A REL=DEFINITION HREF="../Body/m_w_in_f.htm#with-input-from-string"><B>WITH-INPUT-FROM-STRING</B></A><P>
|
|
<A REL=DEFINITION HREF="../Body/m_w_out_.htm#with-output-to-string"><B>WITH-OUTPUT-TO-STRING</B></A><P>
|
|
Related issues: <A HREF="iss362.htm">WITH-OPEN-FILE-SETQ</A><P>
|
|
<B>Category:</B> CLARIFICATION<P>
|
|
<B>Edit history:</B> v1, 13 Feb 1991, Sandra Loosemore<P>
|
|
v2, 11 Mar 1991, Sandra Loosemore (two proposals)<P>
|
|
v3, 26 Mar 1991, Sandra Loosemore (fix typos)<P>
|
|
<B>Status:</B> v3 (proposal <A REL=DEFINITION HREF="../Body/d_dynami.htm#dynamic-extent"><B>DYNAMIC-EXTENT</B></A>) accepted by X3J13, Mar 1991<P>
|
|
<P>
|
|
<B>Problem description:<P>
|
|
</B><P>
|
|
CLtL says that the streams created by <A REL=DEFINITION HREF="../Body/m_w_op_1.htm#with-open-stream"><B>WITH-OPEN-STREAM</B></A>, <P>
|
|
<A REL=DEFINITION HREF="../Body/m_w_in_f.htm#with-input-from-string"><B>WITH-INPUT-FROM-STRING</B></A>, and <A REL=DEFINITION HREF="../Body/m_w_out_.htm#with-output-to-string"><B>WITH-OUTPUT-TO-STRING</B></A> should be regarded<P>
|
|
as having dynamic extent. It is not clear whether "dynamic extent"<P>
|
|
is being used here in a technical sense to mean that it is valid for<P>
|
|
the expansion of these macros to include a <A REL=DEFINITION HREF="../Body/d_dynami.htm#dynamic-extent"><B>DYNAMIC-EXTENT</B></A> declaration<P>
|
|
for the variable(s) bound to the stream.<P>
|
|
<P>
|
|
The description of <A REL=DEFINITION HREF="../Body/m_w_open.htm#with-open-file"><B>WITH-OPEN-FILE</B></A> says nothing about whether the<P>
|
|
stream it creates has dynamic extent. It probably should inherit<P>
|
|
whatever restrictions are placed on <A REL=DEFINITION HREF="../Body/m_w_op_1.htm#with-open-stream"><B>WITH-OPEN-STREAM</B></A>, so you can <P>
|
|
implement it that way.<P>
|
|
<P>
|
|
There are two proposals, <A REL=DEFINITION HREF="../Body/d_dynami.htm#dynamic-extent"><B>DYNAMIC-EXTENT</B></A> and INDEFINITE-EXTENT.<P>
|
|
<P>
|
|
<B>Proposal (WITH-OPEN-FILE-STREAM-EXTENT:DYNAMIC-EXTENT):<P>
|
|
</B><P>
|
|
Clarify that the streams created by <A REL=DEFINITION HREF="../Body/m_w_op_1.htm#with-open-stream"><B>WITH-OPEN-STREAM</B></A>,<P>
|
|
<A REL=DEFINITION HREF="../Body/m_w_in_f.htm#with-input-from-string"><B>WITH-INPUT-FROM-STRING</B></A>, <A REL=DEFINITION HREF="../Body/m_w_out_.htm#with-output-to-string"><B>WITH-OUTPUT-TO-STRING</B></A>, and <A REL=DEFINITION HREF="../Body/m_w_open.htm#with-open-file"><B>WITH-OPEN-FILE</B></A><P>
|
|
have dynamic extent in the technical sense of the <A REL=DEFINITION HREF="../Body/d_dynami.htm#dynamic-extent"><B>DYNAMIC-EXTENT</B></A><P>
|
|
declaration. The extent of the stream ends when the form is exited.<P>
|
|
<P>
|
|
Rationale for proposal DYNAMIC-EXTENT:<P>
|
|
<P>
|
|
If we don't mean the technical definition of <A REL=DEFINITION HREF="../Body/d_dynami.htm#dynamic-extent"><B>DYNAMIC-EXTENT</B></A>, we<P>
|
|
might as well not say anything about dynamic extent.<P>
|
|
<P>
|
|
<P>
|
|
<B>Proposal (WITH-OPEN-FILE-STREAM-EXTENT:INDEFINITE-EXTENT):<P>
|
|
</B><P>
|
|
Specify that the streams created by <A REL=DEFINITION HREF="../Body/m_w_op_1.htm#with-open-stream"><B>WITH-OPEN-STREAM</B></A>,<P>
|
|
<A REL=DEFINITION HREF="../Body/m_w_in_f.htm#with-input-from-string"><B>WITH-INPUT-FROM-STRING</B></A>, <A REL=DEFINITION HREF="../Body/m_w_out_.htm#with-output-to-string"><B>WITH-OUTPUT-TO-STRING</B></A>, and <A REL=DEFINITION HREF="../Body/m_w_open.htm#with-open-file"><B>WITH-OPEN-FILE</B></A><P>
|
|
have indefinite extent.<P>
|
|
<P>
|
|
Rationale for proposal INDEFINITE-EXTENT:<P>
|
|
<P>
|
|
It has been suggested that the mention of "dynamic extent" in CLtL<P>
|
|
was really a sloppy way of saying that the stream would be closed<P>
|
|
after the dynamic extent of the body was exited.<P>
|
|
<P>
|
|
It is better for the language to take the conservative point of view<P>
|
|
and make objects generally have indefinite extent, leaving it up to<P>
|
|
users to declare which things they want to be more ephemeral.<P>
|
|
<P>
|
|
<P>
|
|
<B>Current Practice:<P>
|
|
</B><P>
|
|
I don't know.<P>
|
|
<P>
|
|
<B>Cost to Implementors:<P>
|
|
</B><P>
|
|
None (<A REL=DEFINITION HREF="../Body/d_dynami.htm#dynamic-extent"><B>DYNAMIC-EXTENT</B></A> declarations are optional).<P>
|
|
<P>
|
|
<B>Cost to Users:<P>
|
|
</B><P>
|
|
Probably small, for either proposal. It's possible that some people<P>
|
|
do things like:<P>
|
|
<P>
|
|
(<A REL=DEFINITION HREF="../Body/f_tn.htm#truename"><B>truename</B></A> (<A REL=DEFINITION HREF="../Body/m_w_open.htm#with-open-file"><B>with-open-file</B></A> (<A REL=DEFINITION HREF="../Body/t_stream.htm#stream"><B>stream</B></A> ...) ... <A REL=DEFINITION HREF="../Body/t_stream.htm#stream"><B>stream</B></A>))<P>
|
|
<P>
|
|
but it's not clear that these things are now portable anyway.<P>
|
|
<P>
|
|
<B>Cost of non-adoption:<P>
|
|
</B><P>
|
|
The language specification will be vague. Implementations might <P>
|
|
be prevented from making a minor optimization. Users may encounter<P>
|
|
portability problems.<P>
|
|
<P>
|
|
<B>Performance impact:<P>
|
|
</B><P>
|
|
Adoption of proposal <A REL=DEFINITION HREF="../Body/d_dynami.htm#dynamic-extent"><B>DYNAMIC-EXTENT</B></A> will permit the stream objects <P>
|
|
to be stack-allocated by default.<P>
|
|
<P>
|
|
<B>Benefits:<P>
|
|
</B><P>
|
|
The cost of non-adoption is avoided.<P>
|
|
<P>
|
|
<B>Esthetics:<P>
|
|
</B><P>
|
|
Consistent use of "dynamic extent" terminology is a good thing.<P>
|
|
<P>
|
|
<B>Discussion:<P>
|
|
</B><P>
|
|
Loosemore thinks either of the two proposals would be an improvement<P>
|
|
over the status quo.<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>
|