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

128 lines
8 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 READER-ERROR 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/iss288_w.htm">
<LINK REL=UP HREF="../Issues/iss289.htm">
<LINK REL=NEXT HREF="../Issues/iss290_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/iss288_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss289.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss290_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
<HR>
<H2>Issue READER-ERROR Writeup</H2>
<PRE><B>Forum:</B> Cleanup<P>
<B>Issue:</B> <A REL=DEFINITION HREF="../Body/e_rder_e.htm#reader-error"><B>READER-ERROR</B></A><P>
<B>References:</B> Chapter 3, &quot;Syntax&quot;<P>
Section 2.2, &quot;Types&quot;<P>
<B>Category:</B> ADDITION, CHANGE<P>
<B>Edit History:</B> V1, 23 Oct 1989, Sandra Loosemore<P>
V2, 02 Nov 1989, Sandra Loosemore<P>
(change supertypes, update discussion)<P>
V3, 10 Jul 1990, David Moon (include amendment from meeting)<P>
<P>
<P>
<B>Problem Description:<P>
</B><P>
Chapter 3 of the current draft is not consistent about the types of<P>
errors that must be signalled by the reader. In most places where it<P>
specifies that an error is to be signalled, it does not indicate a<P>
particular type of error, but in at least one situation it requires<P>
the error to be of type <A REL=DEFINITION HREF="../Body/e_progra.htm#program-error"><B>PROGRAM-ERROR</B></A>, and in other cases it requires<P>
the error to be of type <A REL=DEFINITION HREF="../Body/a_error.htm#error"><B>ERROR</B></A>.<P>
<P>
None of the <A REL=DEFINITION HREF="../Body/a_error.htm#error"><B>ERROR</B></A> subtypes described in section 2.2 really seem<P>
appropriate for syntactic errors detected by the reader. In<P>
particular, the description of <A REL=DEFINITION HREF="../Body/e_progra.htm#program-error"><B>PROGRAM-ERROR</B></A> implies that its purpose<P>
is for errors relating to program syntax which are detectable during<P>
evaluation or compilation rather than read-time errors. It seems<P>
especially inappropriate to use <A REL=DEFINITION HREF="../Body/e_progra.htm#program-error"><B>PROGRAM-ERROR</B></A> for this purpose since<P>
the reader can be used to read things other than programs. Likewise,<P>
<A REL=DEFINITION HREF="../Body/e_stm_er.htm#stream-error"><B>STREAM-ERROR</B></A> appears to have been intended to be used for errors<P>
relating to character-level transactions on the stream rather than<P>
lexical analysis or parsing.<P>
<P>
<P>
<B>Proposal (READER-ERROR:NEW-TYPE):<P>
</B><P>
Add a new type specifier, <A REL=DEFINITION HREF="../Body/e_parse_.htm#parse-error"><B>PARSE-ERROR</B></A>. This is a subtype of the<P>
types <A REL=DEFINITION HREF="../Body/e_stm_er.htm#stream-error"><B>STREAM-ERROR</B></A>, <A REL=DEFINITION HREF="../Body/a_error.htm#error"><B>ERROR</B></A>, <A REL=DEFINITION HREF="../Body/e_seriou.htm#serious-condition"><B>SERIOUS-CONDITION</B></A>, <A REL=DEFINITION HREF="../Body/e_cnd.htm#condition"><B>CONDITION</B></A>, and T. The<P>
type <A REL=DEFINITION HREF="../Body/e_parse_.htm#parse-error"><B>PARSE-ERROR</B></A> consists of serious conditions that relate to<P>
lexical analysis (the building and interpretation of tokens) and<P>
parsing (errors in reader macro syntax) by the Lisp reader.<P>
<P>
Since <A REL=DEFINITION HREF="../Body/e_parse_.htm#parse-error"><B>PARSE-ERROR</B></A> is a subtype of <A REL=DEFINITION HREF="../Body/e_stm_er.htm#stream-error"><B>STREAM-ERROR</B></A>, objects of this type<P>
inherit a <A REL=DEFINITION HREF="../Body/t_stream.htm#stream"><B>STREAM</B></A> slot, which can be accessed using the function<P>
<A REL=DEFINITION HREF="../Body/f_stm_er.htm#stream-error-stream"><B>STREAM-ERROR-STREAM</B></A>.<P>
<P>
Change the discussion in chapter 3 to specify that the type of errors<P>
signalled by the reader is <A REL=DEFINITION HREF="../Body/e_parse_.htm#parse-error"><B>PARSE-ERROR</B></A>. There are numerous places<P>
that would be affected.<P>
<P>
<P>
<B>Rationale:<P>
</B><P>
The general policy that has been followed in other areas of the<P>
language where errors must, should, or might be signalled is to<P>
specify a particular subtype of <A REL=DEFINITION HREF="../Body/a_error.htm#error"><B>ERROR</B></A> which covers that <A REL=DEFINITION HREF="../Body/t_class.htm#class"><B>class</B></A> of<P>
errors. Doing the same for reader errors would be consistent with the<P>
overall policy, but none of the existing error types seem appropriate<P>
for reader-related errors.<P>
<P>
<P>
<B>Current Practice:<P>
</B><P>
LispWorks (from Harlequin) reportedly already uses such a condition.<P>
<P>
<P>
<B>Cost to implementors:<P>
</B><P>
Trivial.<P>
<P>
<P>
<B>Cost to users:<P>
</B><P>
Probably no user programs rely on the reader signalling any particular<P>
type of error yet.<P>
<P>
<P>
<B>Benefits:<P>
</B><P>
Increased consistency in the language design.<P>
Ability to set up handlers specifically for reader errors.<P>
<P>
<P>
<B>Discussion:<P>
</B><P>
Pitman says:<P>
Our later comments will show that i would like this condition to be<P>
called <A REL=DEFINITION HREF="../Body/e_parse_.htm#parse-error"><B>PARSE-ERROR</B></A> so that it doesn't seem to be useful only for <P>
READ-related problems but can in fact be used for other parser-style<P>
applications (e.g., a FORTRAN parser, a user-written English-language<P>
interface, etc.).<P>
<P>
The initial version of this proposal specified that <A REL=DEFINITION HREF="../Body/e_parse_.htm#parse-error"><B>PARSE-ERROR</B></A> was<P>
disjoint from (rather than a subtype of) <A REL=DEFINITION HREF="../Body/e_stm_er.htm#stream-error"><B>STREAM-ERROR</B></A>. This was<P>
changed because there was a suggestion that some conditions should be<P>
both a <A REL=DEFINITION HREF="../Body/e_parse_.htm#parse-error"><B>PARSE-ERROR</B></A> and a <A REL=DEFINITION HREF="../Body/e_stm_er.htm#stream-error"><B>STREAM-ERROR</B></A>. Making it a subtype also allows<P>
it to inherit the <A REL=DEFINITION HREF="../Body/t_stream.htm#stream"><B>STREAM</B></A> slot and the <A REL=DEFINITION HREF="../Body/f_stm_er.htm#stream-error-stream"><B>STREAM-ERROR-STREAM</B></A> accessor.<P>
<P>
Prior to version 3 the condition <A REL=DEFINITION HREF="../Body/e_parse_.htm#parse-error"><B>PARSE-ERROR</B></A> was named <A REL=DEFINITION HREF="../Body/e_rder_e.htm#reader-error"><B>READER-ERROR</B></A>.<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>