189 lines
13 KiB
HTML
189 lines
13 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 READ-SUPPRESS-CONFUSING 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/iss287_w.htm">
|
||
|
<LINK REL=UP HREF="../Issues/iss288.htm">
|
||
|
<LINK REL=NEXT HREF="../Issues/iss289_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/iss287_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss288.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss289_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
||
|
|
||
|
<HR>
|
||
|
|
||
|
|
||
|
|
||
|
<H2>Issue READ-SUPPRESS-CONFUSING Writeup</H2>
|
||
|
|
||
|
<PRE><B>Forum:</B> Public Review<P>
|
||
|
<B>Issue:</B> <A HREF="iss288.htm">READ-SUPPRESS-CONFUSING</A><P>
|
||
|
<B>References:</B> Margolin's PR comment #2 (X3J13/92-1402)<P>
|
||
|
Margolin's PR comment #18 (X3J13/92-1418)<P>
|
||
|
Flanagan's PR comment #7 (X3J13/92-1907)<P>
|
||
|
Philpot's PR comment #1 (X3J13/92-2901)<P>
|
||
|
Barrett's PR comment #9 (X3J13/92-3109), part 2<P>
|
||
|
<A REL=DEFINITION HREF="../Body/v_rd_sup.htm#STread-suppressST"><B>*READ-SUPPRESS*</B></A> (X3J13/92-102 pp.23-21..22)<P>
|
||
|
Sharpsign P (X3J13/92-102 sec.2.4.8.14)<P>
|
||
|
Sharpsign C (X3J13/92-102 sec.2.4.8.11)<P>
|
||
|
<B>Category:</B> CHANGE<P>
|
||
|
<B>Edit history:</B> 5 Jan 1993, Version 1 by Margolin<P>
|
||
|
22 May 1993, Version 2 by Loosemore (delete bogus reference<P>
|
||
|
to ":" and "@" in dispatching macro syntax)<P>
|
||
|
<B>Status:</B> Proposal GENERALIZE passed 9-2 on letter ballot 93-302<P>
|
||
|
<P>
|
||
|
<P>
|
||
|
<B>Problem description:<P>
|
||
|
</B><P>
|
||
|
The description of <A REL=DEFINITION HREF="../Body/v_rd_sup.htm#STread-suppressST"><B>*READ-SUPPRESS*</B></A> is confusing and incomplete. By<P>
|
||
|
specifying the behavior of particular read syntaxes rather than a simple,<P>
|
||
|
general strategy, some syntaxes (#C, #P, and#') have unintentionally been<P>
|
||
|
omitted. And the wording of the description of the behavior of #(...) is<P>
|
||
|
unclear as to whether the vector syntax is parsed and ignored or a vector<P>
|
||
|
is actually constructed (there's a subtle difference between the CLtL and<P>
|
||
|
dpANS wording, due to the lack of a pair of parentheses in the dpANS).<P>
|
||
|
<P>
|
||
|
A strict reading of the current description of <A REL=DEFINITION HREF="../Body/v_rd_sup.htm#STread-suppressST"><B>*READ-SUPPRESS*</B></A> implies<P>
|
||
|
that the reader must still construct objects in response to these<P>
|
||
|
syntaxes (as well as user-defined reader macros that don't check the<P>
|
||
|
variable). This is pretty wasteful considering that <A REL=DEFINITION HREF="../Body/v_rd_sup.htm#STread-suppressST"><B>*READ-SUPPRESS*</B></A><P>
|
||
|
exists primarily to support #+ and #-, which discard what they read with<P>
|
||
|
<A REL=DEFINITION HREF="../Body/v_rd_sup.htm#STread-suppressST"><B>*READ-SUPPRESS*</B></A> true anyway.<P>
|
||
|
<P>
|
||
|
In the case of #P, the lack of specification of its <A REL=DEFINITION HREF="../Body/v_rd_sup.htm#STread-suppressST"><B>*READ-SUPPRESS*</B></A><P>
|
||
|
behavior is a real annoyance, because some implementations have extended<P>
|
||
|
it to allow non-strings to follow it. Users expect to be able to hide<P>
|
||
|
such extensions using #+, but this isn't valid.<P>
|
||
|
<P>
|
||
|
<B>Proposal (READ-SUPPRESS-CONFUSING:GENERALIZE):<P>
|
||
|
</B><P>
|
||
|
1) Replace the portion of the Description of <A REL=DEFINITION HREF="../Body/v_rd_sup.htm#STread-suppressST"><B>*READ-SUPPRESS*</B></A> from<P>
|
||
|
"Extended tokens" through the entry for "#A, #S, #:" with:<P>
|
||
|
<P>
|
||
|
When <A REL=DEFINITION HREF="../Body/v_rd_sup.htm#STread-suppressST"><B>*READ-SUPPRESS*</B></A> is true, <A REL=DEFINITION HREF="../Body/f_rd_rd.htm#read"><B>READ</B></A>, <A REL=DEFINITION HREF="../Body/f_rd_rd.htm#read-preserving-whitespace"><B>READ-PRESERVING-WHITESPACE</B></A>,<P>
|
||
|
<A REL=DEFINITION HREF="../Body/f_rd_del.htm#read-delimited-list"><B>READ-DELIMITED-LIST</B></A>, and <A REL=DEFINITION HREF="../Body/f_rd_fro.htm#read-from-string"><B>READ-FROM-STRING</B></A> all return a first value of<P>
|
||
|
<A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A> when they complete successfully; however, they continue to parse<P>
|
||
|
the representation of an object in the normal way, in order to skip<P>
|
||
|
over the object, and continue to indicate <A REL=DEFINITION HREF="../Body/e_end_of.htm#end-of-file"><B>end-of-file</B></A> in the normal<P>
|
||
|
way. Except as noted below, any <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> macro character (including<P>
|
||
|
dispatching macro sub-characters) that is defined to read a following<P>
|
||
|
object or token will do so, but not signal an error if the object<P>
|
||
|
read is not of an appropriate type or syntax. Standard syntaxes and<P>
|
||
|
macro characters will not construct any new objects (e.g. when<P>
|
||
|
reading the representation of a symbol, no symbol will be constructed<P>
|
||
|
or interned).<P>
|
||
|
<P>
|
||
|
Dispatching macro characters (including #)<P>
|
||
|
<P>
|
||
|
Dispatching macro characters continue to parse an infix numerical<P>
|
||
|
argument, and invoke the<P>
|
||
|
dispatch function. The <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> # dispatching macro characters<P>
|
||
|
do not enforce any constraints on the value or existence of the<P>
|
||
|
numerical argument.<P>
|
||
|
<P>
|
||
|
2) Create a Notes section that recommends that user-defined and<P>
|
||
|
implementation-defined macro characters behave analogously to the<P>
|
||
|
<A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> macro character, i.e. when <A REL=DEFINITION HREF="../Body/v_rd_sup.htm#STread-suppressST"><B>*READ-SUPPRESS*</B></A> is true they should<P>
|
||
|
ignore type errors when reading a following object and dispatching macro<P>
|
||
|
characters should allow <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A> as an infix parameter.<P>
|
||
|
<P>
|
||
|
3) Change the specifications of #C and #P to specify that they are<P>
|
||
|
followed by the representation of an object. Then specify how they are<P>
|
||
|
interpreted when those objects are a list of two real numbers (for #C) or<P>
|
||
|
a string (for #P).<P>
|
||
|
<P>
|
||
|
<B>Examples:<P>
|
||
|
</B><P>
|
||
|
(<A REL=DEFINITION HREF="../Body/s_let_l.htm#let"><B>let</B></A> ((<A REL=DEFINITION HREF="../Body/v_rd_sup.htm#STread-suppressST"><B>*read-suppress*</B></A> t))<P>
|
||
|
(<A REL=DEFINITION HREF="../Body/m_dolist.htm#dolist"><B>dolist</B></A> (<A REL=DEFINITION HREF="../Body/a_string.htm#string"><B>string</B></A> '("#(foo bar baz)" "#P(:type :lisp)" "#c1.2" "foo"))<P>
|
||
|
(<A REL=DEFINITION HREF="../Body/m_when_.htm#unless"><B>unless</B></A> <P>
|
||
|
(<A REL=DEFINITION HREF="../Body/m_ignore.htm#ignore-errors"><B>ignore-errors</B></A><P>
|
||
|
(<A REL=DEFINITION HREF="../Body/s_progn.htm#progn"><B>progn</B></A> (<A REL=DEFINITION HREF="../Body/f_wr_pr.htm#print"><B>print</B></A> (<A REL=DEFINITION HREF="../Body/f_rd_fro.htm#read-from-string"><B>read-from-string</B></A> <A REL=DEFINITION HREF="../Body/a_string.htm#string"><B>string</B></A>))<P>
|
||
|
t))<P>
|
||
|
(<A REL=DEFINITION HREF="../Body/f_wr_pr.htm#print"><B>print</B></A> '<A REL=DEFINITION HREF="../Body/a_error.htm#error"><B>error</B></A>))))<P>
|
||
|
could print<P>
|
||
|
#(<A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A> <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A> <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A>)<P>
|
||
|
<A REL=DEFINITION HREF="../Body/a_error.htm#error"><B>ERROR</B></A><P>
|
||
|
<A REL=DEFINITION HREF="../Body/a_error.htm#error"><B>ERROR</B></A><P>
|
||
|
<P>
|
||
|
<B>Test Cases:<P>
|
||
|
</B><P>
|
||
|
(<A REL=DEFINITION HREF="../Body/s_let_l.htm#let"><B>let</B></A> ((<A REL=DEFINITION HREF="../Body/v_rd_sup.htm#STread-suppressST"><B>*read-suppress*</B></A> t))<P>
|
||
|
(<A REL=DEFINITION HREF="../Body/f_mapc_.htm#mapcar"><B>mapcar</B></A> #'<A REL=DEFINITION HREF="../Body/f_rd_fro.htm#read-from-string"><B>read-from-string</B></A><P>
|
||
|
'("#(foo bar baz)" "#P(:type :lisp)" "#c1.2")))<P>
|
||
|
-> (<A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A> <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A> <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A>)<P>
|
||
|
<P>
|
||
|
<B>Rationale:<P>
|
||
|
</B><P>
|
||
|
1) Specifies a general behavior for <A REL=DEFINITION HREF="../Body/v_rd_sup.htm#STread-suppressST"><B>*READ-SUPPRESS*</B></A> that is applicable to<P>
|
||
|
all reader syntaxes that are described in terms of the representations of<P>
|
||
|
objects.<P>
|
||
|
<P>
|
||
|
2) Encourages implementors and users to extrapolate from this <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A><P>
|
||
|
behavior.<P>
|
||
|
<P>
|
||
|
3) Specifies #P and #C in such a way that change 1 applies.<P>
|
||
|
<P>
|
||
|
<B>Current practice:<P>
|
||
|
</B><P>
|
||
|
For the Example form, Genera 8.1 prints <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A>, <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A>, <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A> (it seems to<P>
|
||
|
implement the proposal); Lucid 4.1 and CMU CL 16d print <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A>, <A REL=DEFINITION HREF="../Body/a_error.htm#error"><B>ERROR</B></A>, NIL;<P>
|
||
|
WCL 2.1 prints #(<A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A> <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A> <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A>), <A REL=DEFINITION HREF="../Body/a_error.htm#error"><B>ERROR</B></A>, <A REL=DEFINITION HREF="../Body/a_error.htm#error"><B>ERROR</B></A>.<P>
|
||
|
<P>
|
||
|
<B>Cost to Implementors:<P>
|
||
|
</B><P>
|
||
|
Should be minor.<P>
|
||
|
<P>
|
||
|
<B>Cost to Users:<P>
|
||
|
</B><P>
|
||
|
When <A REL=DEFINITION HREF="../Body/v_rd_sup.htm#STread-suppressST"><B>*READ-SUPPRESS*</B></A> is bound via #+ or #-, the change should be upward<P>
|
||
|
compatible, since any objects constructed by the reader will not be<P>
|
||
|
visible. Direct users of <A REL=DEFINITION HREF="../Body/v_rd_sup.htm#STread-suppressST"><B>*READ-SUPPRESS*</B></A> may notice the difference, but<P>
|
||
|
it seems unlikely that anyone is depending on any of the current<P>
|
||
|
behaviors.<P>
|
||
|
<P>
|
||
|
<B>Cost of non-adoption:<P>
|
||
|
</B><P>
|
||
|
Users will have to avoid using some implementation-dependent syntaxes in<P>
|
||
|
#P macros.<P>
|
||
|
<P>
|
||
|
<B>Performance impact:<P>
|
||
|
</B><P>
|
||
|
Minor.<P>
|
||
|
<P>
|
||
|
<B>Benefits:<P>
|
||
|
</B><P>
|
||
|
More ability to include implementation-dependent syntax extensions in<P>
|
||
|
portable source code.<P>
|
||
|
<P>
|
||
|
<B>Esthetics:<P>
|
||
|
</B><P>
|
||
|
A general description of behavior is better than lots of specific cases.<P>
|
||
|
<P>
|
||
|
<B>Editorial Impact:<P>
|
||
|
</B><P>
|
||
|
Minor. The changes are confined to the three sections mentioned above.<P>
|
||
|
<P>
|
||
|
<B>Discussion:<P>
|
||
|
</B><P>
|
||
|
Barmar originally wanted to specify that <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> dispatching macros<P>
|
||
|
would parse the numerical argument but ignore it (always passing <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A> to<P>
|
||
|
the dispatch function). Flanagan convinced him to leave that part as it<P>
|
||
|
was originally (the numeric argument is parsed but <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> dispatch<P>
|
||
|
functions don't enforce restrictions on it). It doesn't seem to be a big<P>
|
||
|
deal either way.<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>
|