1
0
Fork 0
cl-sites/HyperSpec-7-0/HyperSpec/Issues/iss261_w.htm
2024-04-01 10:24:07 +02:00

125 lines
8.7 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 PATHNAME-STREAM 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/iss260_w.htm">
<LINK REL=UP HREF="../Issues/iss261_m.htm">
<LINK REL=NEXT HREF="../Issues/iss263_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/iss260_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss261_m.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss263_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
<HR>
<H2>Issue PATHNAME-STREAM Writeup</H2>
<PRE><B>Issue:</B> <A HREF="iss261_m.htm">PATHNAME-STREAM</A><P>
<P>
<B>References:</B> <A REL=DEFINITION HREF="../Body/a_pn.htm#pathname"><B>PATHNAME</B></A> (p.413), also the introductory text right above<P>
it on the same page.<P>
Derived references: <A REL=DEFINITION HREF="../Body/f_tn.htm#truename"><B>TRUENAME</B></A> (p.413), <A REL=DEFINITION HREF="../Body/f_pars_1.htm#parse-namestring"><B>PARSE-NAMESTRING</B></A> (p.414),<P>
<A REL=DEFINITION HREF="../Body/f_merge_.htm#merge-pathnames"><B>MERGE-PATHNAMES</B></A> (p.415), <A REL=DEFINITION HREF="../Body/f_pn_hos.htm#pathname-host"><B>PATHNAME-HOST</B></A> etc. (p.417),<P>
<A REL=DEFINITION HREF="../Body/f_open.htm#open"><B>OPEN</B></A> (p.418), <A REL=DEFINITION HREF="../Body/m_w_open.htm#with-open-file"><B>WITH-OPEN-FILE</B></A> (p.422),<P>
<A REL=DEFINITION HREF="../Body/f_rn_fil.htm#rename-file"><B>RENAME-FILE</B></A> (p.423), <A REL=DEFINITION HREF="../Body/f_del_fi.htm#delete-file"><B>DELETE-FILE</B></A> (p.424)<P>
<P>
<B>Edit History:</B> Version 1 by Moon 11-May-87<P>
Version 2 by Masinter 29-May-87 (minor editing)<P>
Version 3 by Masinter 11-Jun-87 (minor editing)<P>
Version 4 by Masinter 8-Oct-87 (rewording)<P>
Version 5 by Masinter 8-Oct-87 (explicitly only open)<P>
Version 6 by Masinter 14-Nov-87<P>
<P>
<B>Category:</B> CHANGE/CLARIFICATION<P>
<P>
<B>Problem Description:<P>
</B><P>
CLtL says that a stream can be used as an argument and converted to a <A REL=DEFINITION HREF="../Body/a_pn.htm#pathname"><B>pathname</B></A>,<P>
but many sources or sinks of data that streams might be connected to have no<P>
pathnames associated with them; for example, streams created with<P>
<A REL=DEFINITION HREF="../Body/f_mk_two.htm#make-two-way-stream"><B>MAKE-TWO-WAY-STREAM</B></A> or OPEN-STRING-STREAM. For many such streams, there is no<P>
simple way to coerce such a stream to a <A REL=DEFINITION HREF="../Body/a_pn.htm#pathname"><B>pathname</B></A>.<P>
<P>
<B>Proposal PATHNAME-STREAM:FILES-OR-SYNONYM:<P>
</B><P>
Clarify that the use of a stream as an argument that expects a <A REL=DEFINITION HREF="../Body/a_pn.htm#pathname"><B>pathname</B></A> (as<P>
described on p413 of CLtL) only applies to streams that are originally opened by<P>
use of the <A REL=DEFINITION HREF="../Body/f_open.htm#open"><B>OPEN</B></A> or <A REL=DEFINITION HREF="../Body/m_w_open.htm#with-open-file"><B>WITH-OPEN-FILE</B></A>, or to synonym streams whose symbol is bound<P>
to such a stream. It is an error to attempt to obtain a <A REL=DEFINITION HREF="../Body/a_pn.htm#pathname"><B>pathname</B></A> from a stream<P>
created with <A REL=DEFINITION HREF="../Body/f_mk_two.htm#make-two-way-stream"><B>MAKE-TWO-WAY-STREAM</B></A>, OPEN-STRING-STREAM, <A REL=DEFINITION HREF="../Body/f_mk_ech.htm#make-echo-stream"><B>MAKE-ECHO-STREAM</B></A>,<P>
<A REL=DEFINITION HREF="../Body/f_mk_bro.htm#make-broadcast-stream"><B>MAKE-BROADCAST-STREAM</B></A>, <A REL=DEFINITION HREF="../Body/f_mk_con.htm#make-concatenated-stream"><B>MAKE-CONCATENATED-STREAM</B></A>, <A REL=DEFINITION HREF="../Body/f_mk_s_1.htm#make-string-input-stream"><B>MAKE-STRING-INPUT-STREAM</B></A>,<P>
<A REL=DEFINITION HREF="../Body/f_mk_s_2.htm#make-string-output-stream"><B>MAKE-STRING-OUTPUT-STREAM</B></A>.<P>
<P>
The <A REL=DEFINITION HREF="../Body/a_pn.htm#pathname"><B>pathname</B></A> used represents the name used to open the file. This may be, but is<P>
not required to be, the actual name of the file. The <A REL=DEFINITION HREF="../Body/a_pn.htm#pathname"><B>pathname</B></A> used is the same<P>
as would be returned by the <A REL=DEFINITION HREF="../Body/a_pn.htm#pathname"><B>PATHNAME</B></A> function.<P>
<P>
<B>Rationale:<P>
</B><P>
This is probably what the designers of Common Lisp intended. This is the only<P>
thing that can be implemented without large changes to the language such as<P>
extending pathnames to things other than files. <P>
<P>
<B>Current Practice:<P>
</B><P>
Some systems signal an error if a non-file stream is used as a <A REL=DEFINITION HREF="../Body/a_pn.htm#pathname"><B>pathname</B></A>. Others<P>
return an empty <A REL=DEFINITION HREF="../Body/a_pn.htm#pathname"><B>pathname</B></A>.<P>
<P>
Some implementations do not return a meaningful value for <A REL=DEFINITION HREF="../Body/a_pn.htm#pathname"><B>PATHNAME</B></A> of a synonym<P>
stream.<P>
<P>
<B>Adoption Cost:<P>
</B><P>
Implementations that do not currently handle <A REL=DEFINITION HREF="../Body/a_pn.htm#pathname"><B>PATHNAME</B></A> of a synonym stream will<P>
have to change to allow it. Otherwise, since the proposal says only &quot;is an<P>
error&quot; rather than &quot;signals an error&quot;, no implementations other changes are<P>
necessary.<P>
<P>
<B>Benefits:<P>
</B><P>
The description of <A REL=DEFINITION HREF="../Body/a_pn.htm#pathname"><B>pathname</B></A> functions will make more sense.<P>
<P>
<B>Conversion Cost: <P>
</B><P>
Small: Users with code which accesses <A REL=DEFINITION HREF="../Body/a_pn.htm#pathname"><B>pathname</B></A> components of streams in<P>
implementations which allow it might need to change their programs to make them<P>
portable.<P>
<P>
<B>Aesthetics:<P>
</B><P>
Makes language a little cleaner.<P>
<P>
<B>Discussion: <P>
</B><P>
The only point of disagreement on this proposal has been on the issue of whether<P>
<A REL=DEFINITION HREF="../Body/a_pn.htm#pathname"><B>PATHNAME</B></A> applies to synonym streams and returns the <A REL=DEFINITION HREF="../Body/a_pn.htm#pathname"><B>pathname</B></A> of the stream<P>
designated. <P>
<P>
This version of the proposal says yes, because CLtL p 329 says about synonym<P>
streams that &quot;Any operations on the new stream ...&quot; and does not say anything<P>
about exceptions; earlier on the page the phrase &quot;synonym streams that pass all<P>
operations on&quot; is used. This seems fairly unambiguous, although the word<P>
&quot;operations&quot; is not defined. There was a similar controversy about what <A REL=DEFINITION HREF="../Body/f_close.htm#close"><B>CLOSE</B></A> of<P>
a synonym stream means.<P>
<P>
Note that there is currently no way portable to determine whether a stream has a<P>
<A REL=DEFINITION HREF="../Body/a_pn.htm#pathname"><B>pathname</B></A> available. <P>
<P>
The entire <A REL=DEFINITION HREF="../Body/a_pn.htm#pathname"><B>PATHNAME</B></A> section needs work to clarify the intent and enable portable<P>
code. This is just a minor issue among the major ones.<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>