1
0
Fork 0
cl-sites/novaspec.org/cl/v_read-suppress.html

512 lines
11 KiB
HTML
Raw Normal View History

2025-02-05 18:52:26 +01:00
<!DOCTYPE HTML>
<HTML LANG="en-us"
><HEAD
><TITLE
>*read-suppress* | Common Lisp Nova Spec</TITLE
><META CHARSET="US-ASCII"
><LINK REL="canonical" HREF="v_read-suppress.html"
><LINK REL="next" HREF="v_readtable.html" TYPE="text/html" TITLE="*readtable*"
><LINK REL="prev" HREF="v_read-eval.html" TYPE="text/html" TITLE="*read-eval*"
><LINK REL="up" HREF="23_2_Reader_Dictionary.html" TYPE="text/html" TITLE="23.2 Reader Dictionary"
><LINK REL="start" HREF="index.html" TYPE="text/html" TITLE="Common Lisp Nova Spec"
><META NAME="VIEWPORT" CONTENT="width=device-width, initial-scale=1.0"
><LINK REL="STYLESHEET" HREF="dpans.css%3F3909942064.css"
><SCRIPT SRC="dpans.js%3F3909942064"
></SCRIPT
><SCRIPT SRC="apropos.js%3F3909942064"
></SCRIPT
></HEAD
><BODY
><DIV
><DIV CLASS="topnav"
><DIV CLASS="breadcrumb"
><SPAN CLASS="breadcrumb-item"
><A HREF="index.html"
>Common Lisp Nova Spec</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="23_Reader.html"
>23. Reader</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="23_2_Reader_Dictionary.html"
>23.2 Reader Dictionary</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="v_read-suppress.html"
>*read-suppress*</A
></SPAN
></DIV
><DIV CLASS="apropos"
><DIV CLASS="apropos-io"
><A HREF="v_read-eval.html" CLASS="prev"
>&#8592;</A
><SPAN ID="apropos-label"
>Apropos </SPAN
><INPUT ID="apropos" AUTOFOCUS="AUTOFOCUS" PLACEHOLDER="Type here to search" ONINPUT="aproposInput(this);" ONKEYUP="aproposKeyup(event);" ONCHANGE="aproposChange(this);" ONFOCUS="aproposFocus(this);" ONFOCUSOUT="aproposFocusout(this);"
><A HREF="v_readtable.html" CLASS="next"
>&#8594;</A
></DIV
><DIV ID="apropos-res"
></DIV
></DIV
></DIV
><DIV CLASS="matter"
><DIV CLASS="com"
><DIV CLASS="begincom"
><HR
><TABLE WIDTH="100%" CELLSPACING="0" CELLPADDING="0"
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" WIDTH="100%" CLASS="name"
><SPAN CLASS="idx" DATA-KIND="idxref" DATA-TERM="*read-suppress*"
></SPAN
><SPAN CLASS="cmsy"
>*</SPAN
><B
>read-suppress</B
><SPAN CLASS="cmsy"
>*</SPAN
></TD
><TD ALIGN="RIGHT" VALIGN="BASELINE" WIDTH="0" NOWRAP="NOWRAP" CLASS="ftype"
><I
>Variable</I
></TD
></TR
></TABLE
><HR
></DIV
><UL CLASS="subtoc"
></UL
><DL
><DT
><B
>Value Type</B
></DT
><DD
><P CLASS="j"
>a <A HREF="26_1_Glossary.html#generalized_boolean"
><EM CLASS="term"
>generalized boolean</EM
></A
>.</P
></DD
><DT
><B
>Initial Value</B
></DT
><DD
><P CLASS="j"
><A HREF="26_1_Glossary.html#false"
><EM CLASS="term"
>false</EM
></A
>.</P
></DD
><DT
><B
>Description</B
></DT
><DD
><P CLASS="j"
>This variable is intended primarily to support the operation of the read-time conditional notations <CODE CLASS="f"
>#+</CODE
> and <CODE CLASS="f"
>#-</CODE
>. It is important for the <A HREF="26_1_Glossary.html#reader_macro"
><EM CLASS="term"
>reader macros</EM
></A
> which implement these notations to be able to skip over the printed representation of an <A HREF="26_1_Glossary.html#expression"
><EM CLASS="term"
>expression</EM
></A
> despite the possibility that the syntax of the skipped <A HREF="26_1_Glossary.html#expression"
><EM CLASS="term"
>expression</EM
></A
> may not be entirely valid for the current implementation, since <CODE CLASS="f"
>#+</CODE
> and <CODE CLASS="f"
>#-</CODE
> exist in order to allow the same program to be shared among several Lisp implementations (including dialects other than Common Lisp) despite small incompatibilities of syntax. </P
><P CLASS="j"
>If it is <A HREF="26_1_Glossary.html#false"
><EM CLASS="term"
>false</EM
></A
>, the <A HREF="26_1_Glossary.html#Lisp_reader"
><EM CLASS="term"
>Lisp reader</EM
></A
> operates normally. </P
><P CLASS="j"
>If the <A HREF="26_1_Glossary.html#value"
><EM CLASS="term"
>value</EM
></A
> of <A HREF="v_read-suppress.html" CLASS="misc"
><B
>*read-suppress*</B
></A
> is <A HREF="26_1_Glossary.html#true"
><EM CLASS="term"
>true</EM
></A
>, <A HREF="f_read.html" CLASS="funref"
><B
>read</B
></A
>, <A HREF="f_read.html" CLASS="funref"
><B
>read-preserving-whitespace</B
></A
>, <A HREF="f_read-delimited-list.html" CLASS="funref"
><B
>read-delimited-list</B
></A
>, and <A HREF="f_read-from-string.html" CLASS="funref"
><B
>read-from-string</B
></A
> all return a <A HREF="26_1_Glossary.html#primary_value"
><EM CLASS="term"
>primary value</EM
></A
> of <SPAN CLASS="misc"
><B
>nil</B
></SPAN
> when they complete successfully; however, they continue to parse the representation of an <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>object</EM
></A
> in the normal way, in order to skip over the <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>object</EM
></A
>, and continue to indicate <A HREF="26_1_Glossary.html#end_of_file"
><EM CLASS="term"
>end of file</EM
></A
> in the normal way. Except as noted below, any <A HREF="26_1_Glossary.html#standardized"
><EM CLASS="term"
>standardized</EM
></A
> <A HREF="26_1_Glossary.html#reader_macro"
><EM CLASS="term"
>reader macro</EM
></A
><SPAN CLASS="meaning"
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>2</SPAN
></SUB
></SPAN
> that is defined to <A HREF="26_1_Glossary.html#read"
><EM CLASS="term"
>read</EM
></A
><SPAN CLASS="meaning"
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>2</SPAN
></SUB
></SPAN
> a following <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>object</EM
></A
> or <A HREF="26_1_Glossary.html#token"
><EM CLASS="term"
>token</EM
></A
> will do so, but not signal an error if the <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>object</EM
></A
> read is not of an appropriate type or syntax. The <A HREF="26_1_Glossary.html#standard_syntax"
><EM CLASS="term"
>standard syntax</EM
></A
> and its associated <A HREF="26_1_Glossary.html#reader_macro"
><EM CLASS="term"
>reader macros</EM
></A
> will not construct any new <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>objects</EM
></A
> (<I CLASS="i"
><I
>e.g.</I
></I
>, when reading the representation of a <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
>, no <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
> will be constructed or interned).</P
><DL
><DT
><SPAN CLASS="cmr"
>Extended</SPAN
> <SPAN CLASS="cmr"
>tokens</SPAN
></DT
><DD
><P CLASS="j"
>All extended tokens are completely uninterpreted. Errors such as those that might otherwise be signaled due to detection of invalid <A HREF="26_1_Glossary.html#potential_number"
><EM CLASS="term"
>potential numbers</EM
></A
>, invalid patterns of <A HREF="26_1_Glossary.html#package_marker"
><EM CLASS="term"
>package markers</EM
></A
>, and invalid uses of the <A HREF="26_1_Glossary.html#dot"
><EM CLASS="term"
>dot</EM
></A
> character are suppressed.</P
></DD
><DT
><SPAN CLASS="cmr"
>Dispatching</SPAN
> <SPAN CLASS="cmr"
>macro</SPAN
> <SPAN CLASS="cmr"
>characters</SPAN
> <SPAN CLASS="cmr"
>(including</SPAN
> <A HREF="26_1_Glossary.html#sharpsign"
><EM CLASS="term"
>sharpsign</EM
></A
><SPAN CLASS="cmr"
>)</SPAN
></DT
><DD
><P CLASS="j"
><A HREF="26_1_Glossary.html#dispatching_macro_character"
><EM CLASS="term"
>Dispatching macro characters</EM
></A
> continue to parse an infix numerical argument, and invoke the dispatch function. The <A HREF="26_1_Glossary.html#standardized"
><EM CLASS="term"
>standardized</EM
></A
> <A HREF="26_1_Glossary.html#sharpsign"
><EM CLASS="term"
>sharpsign</EM
></A
> <A HREF="26_1_Glossary.html#reader_macro"
><EM CLASS="term"
>reader macros</EM
></A
> do not enforce any constraints on either the presence of or the value of the numerical argument.</P
></DD
><DT
><SPAN CLASS="cmtt"
>#=</SPAN
></DT
><DD
><P CLASS="j"
>The <CODE CLASS="f"
>#=</CODE
> notation is totally ignored. It does not read a following <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>object</EM
></A
>. It produces no <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>object</EM
></A
>, but is treated as <A HREF="26_1_Glossary.html#whitespace"
><EM CLASS="term"
>whitespace</EM
></A
><SPAN CLASS="meaning"
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>2</SPAN
></SUB
></SPAN
>.</P
></DD
><DT
><SPAN CLASS="cmtt"
>##</SPAN
></DT
><DD
><P CLASS="j"
>The <CODE CLASS="f"
>##</CODE
> notation always produces <SPAN CLASS="misc"
><B
>nil</B
></SPAN
>.</P
></DD
></DL
><P CLASS="j"
>No matter what the <A HREF="26_1_Glossary.html#value"
><EM CLASS="term"
>value</EM
></A
> of <A HREF="v_read-suppress.html" CLASS="misc"
><B
>*read-suppress*</B
></A
>, parentheses still continue to delimit and construct <A HREF="26_1_Glossary.html#list"
><EM CLASS="term"
>lists</EM
></A
>; the <CODE CLASS="f"
>#(</CODE
> notation continues to delimit <A HREF="26_1_Glossary.html#vector"
><EM CLASS="term"
>vectors</EM
></A
>; and comments, <A HREF="26_1_Glossary.html#string"
><EM CLASS="term"
>strings</EM
></A
>, and the <A HREF="26_1_Glossary.html#single-quote"
><EM CLASS="term"
>single-quote</EM
></A
> and <A HREF="26_1_Glossary.html#backquote"
><EM CLASS="term"
>backquote</EM
></A
> notations continue to be interpreted properly. Such situations as <CODE CLASS="f"
>')</CODE
>, <CODE CLASS="f"
>#&lt;</CODE
>, <CODE CLASS="f"
>#)</CODE
>, and <CODE CLASS="f"
>#<SPAN CLASS="cmsy"
>&#10216;</SPAN
><I
>Space</I
><SPAN CLASS="cmsy"
>&#10217;</SPAN
></CODE
> continue to signal errors.</P
></DD
><DT
><B
>Examples</B
></DT
><DD
><PRE CLASS="screen"
> (let ((*read-suppress* t))
(mapcar #'read-from-string
'("#(foo bar baz)" "#P(:type :lisp)" "#c1.2"
"#.(PRINT 'FOO)" "#3AHELLO" "#S(INTEGER)"
"#*ABC" "#\GARBAGE" "#RALPHA" "#3R444")))
<SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> (NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL)</PRE
></DD
><DT
><B
>See Also</B
></DT
><DD
><P CLASS="j"
><A HREF="f_read.html" CLASS="funref"
><B
>read</B
></A
>, Chapter 2 (Syntax)</P
></DD
><DT
><B
>Notes</B
></DT
><DD
><P CLASS="j"
><A HREF="26_1_Glossary.html#programmer"
><EM CLASS="term"
>Programmers</EM
></A
> and <A HREF="26_1_Glossary.html#implementation"
><EM CLASS="term"
>implementations</EM
></A
> that define additional <A HREF="26_1_Glossary.html#macro_character"
><EM CLASS="term"
>macro characters</EM
></A
> are strongly encouraged to make them respect <A HREF="v_read-suppress.html" CLASS="varref"
><B
>*read-suppress*</B
></A
> just as <A HREF="26_1_Glossary.html#standardized"
><EM CLASS="term"
>standardized</EM
></A
> <A HREF="26_1_Glossary.html#macro_character"
><EM CLASS="term"
>macro characters</EM
></A
> do. That is, when the <A HREF="26_1_Glossary.html#value"
><EM CLASS="term"
>value</EM
></A
> of <A HREF="v_read-suppress.html" CLASS="misc"
><B
>*read-suppress*</B
></A
> is <A HREF="26_1_Glossary.html#true"
><EM CLASS="term"
>true</EM
></A
>, they should ignore type errors when reading a following <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>object</EM
></A
> and the <A HREF="26_1_Glossary.html#function"
><EM CLASS="term"
>functions</EM
></A
> that implement <A HREF="26_1_Glossary.html#dispatching_macro_character"
><EM CLASS="term"
>dispatching macro characters</EM
></A
> should tolerate <SPAN CLASS="misc"
><B
>nil</B
></SPAN
> as their infix <A HREF="26_1_Glossary.html#parameter"
><EM CLASS="term"
>parameter</EM
></A
> value even if a numeric value would ordinarily be required.</P
></DD
></DL
></DIV
></DIV
><DIV CLASS="footer"
><DIV CLASS="btmnav"
><A HREF="v_read-eval.html" CLASS="prev"
>&#8592;</A
><A HREF="v_readtable.html" CLASS="next"
>&#8594;</A
></DIV
><DIV CLASS="trail"
>Conversion to HTML copyright 2023 by Gilbert Baumann</DIV
></DIV
></DIV
><SCRIPT
>domReady();</SCRIPT
></BODY
></HTML
>