225 lines
No EOL
4.9 KiB
HTML
225 lines
No EOL
4.9 KiB
HTML
<!DOCTYPE HTML>
|
|
<HTML LANG="en-us"
|
|
><HEAD
|
|
><TITLE
|
|
>store-value | Common Lisp Nova Spec</TITLE
|
|
><META CHARSET="US-ASCII"
|
|
><LINK REL="canonical" HREF="r_store-value.html"
|
|
><LINK REL="next" HREF="r_use-value.html" TYPE="text/html" TITLE="use-value"
|
|
><LINK REL="prev" HREF="r_muffle-warning.html" TYPE="text/html" TITLE="muffle-warning"
|
|
><LINK REL="up" HREF="9_2_Conditions_Dictionary.html" TYPE="text/html" TITLE="9.2 Conditions 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"
|
|
>→ <A HREF="9_Conditions.html"
|
|
>9. Conditions</A
|
|
></SPAN
|
|
> <SPAN CLASS="breadcrumb-item"
|
|
>→ <A HREF="9_2_Conditions_Dictionary.html"
|
|
>9.2 Conditions Dictionary</A
|
|
></SPAN
|
|
> <SPAN CLASS="breadcrumb-item"
|
|
>→ <A HREF="r_store-value.html"
|
|
>store-value</A
|
|
></SPAN
|
|
></DIV
|
|
><DIV CLASS="apropos"
|
|
><DIV CLASS="apropos-io"
|
|
><A HREF="r_muffle-warning.html" CLASS="prev"
|
|
>←</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="r_use-value.html" CLASS="next"
|
|
>→</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="store-value"
|
|
></SPAN
|
|
><B
|
|
>store-value</B
|
|
></TD
|
|
><TD ALIGN="RIGHT" VALIGN="BASELINE" WIDTH="0" NOWRAP="NOWRAP" CLASS="ftype"
|
|
><I
|
|
>Restart</I
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
></DIV
|
|
><UL CLASS="subtoc"
|
|
></UL
|
|
><DL
|
|
><DT
|
|
><B
|
|
>Data Arguments Required</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
>a value to use instead (on an ongoing basis).</P
|
|
></DD
|
|
><DT
|
|
><B
|
|
>Description</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
>The <SPAN CLASS="misc"
|
|
><B
|
|
>store-value</B
|
|
></SPAN
|
|
> <A HREF="26_1_Glossary.html#restart"
|
|
><EM CLASS="term"
|
|
>restart</EM
|
|
></A
|
|
> is generally used by <A HREF="26_1_Glossary.html#handler"
|
|
><EM CLASS="term"
|
|
>handlers</EM
|
|
></A
|
|
> trying to recover from errors of <A HREF="26_1_Glossary.html#type"
|
|
><EM CLASS="term"
|
|
>types</EM
|
|
></A
|
|
> such as <A HREF="t_cell-error.html" CLASS="typeref"
|
|
><B
|
|
>cell-error</B
|
|
></A
|
|
> or <A HREF="t_type-error.html" CLASS="typeref"
|
|
><B
|
|
>type-error</B
|
|
></A
|
|
>, which may wish to supply a replacement datum to be stored permanently.</P
|
|
></DD
|
|
><DT
|
|
><B
|
|
>Examples</B
|
|
></DT
|
|
><DD
|
|
><PRE CLASS="screen"
|
|
>(defun type-error-auto-coerce (c)
|
|
(when (typep c 'type-error)
|
|
(let ((r (find-restart 'store-value c)))
|
|
(handler-case (let ((v (coerce (type-error-datum c)
|
|
(type-error-expected-type c))))
|
|
(invoke-restart r v))
|
|
(error ()))))) <SPAN CLASS="cmsy"
|
|
><SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
></SPAN
|
|
> TYPE-ERROR-AUTO-COERCE
|
|
(let ((x 3))
|
|
(handler-bind ((type-error #'type-error-auto-coerce))
|
|
(check-type x float)
|
|
x)) <SPAN CLASS="cmsy"
|
|
><SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
></SPAN
|
|
> 3.0</PRE
|
|
></DD
|
|
><DT
|
|
><B
|
|
>See Also</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
><A HREF="9_1_Condition_System_Concepts.html#sec_9_1_4_2" CLASS="secref"
|
|
><SPAN CLASS="cmr"
|
|
>Section</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>9.1.4.2</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>(Restarts)</SPAN
|
|
></A
|
|
>, <A HREF="9_1_Condition_System_Concepts.html#sec_9_1_4_2_2" CLASS="secref"
|
|
><SPAN CLASS="cmr"
|
|
>Section</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>9.1.4.2.2</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>(Interfaces</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>to</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>Restarts)</SPAN
|
|
></A
|
|
>, <A HREF="f_invoke-restart.html" CLASS="funref"
|
|
><B
|
|
>invoke-restart</B
|
|
></A
|
|
>, <A HREF="f_abort.html" CLASS="funref"
|
|
><B
|
|
>store-value</B
|
|
></A
|
|
> (<A HREF="26_1_Glossary.html#function"
|
|
><EM CLASS="term"
|
|
>function</EM
|
|
></A
|
|
>), <A HREF="f_case.html" CLASS="macref"
|
|
><B
|
|
>ccase</B
|
|
></A
|
|
>, <A HREF="f_check-type.html" CLASS="macref"
|
|
><B
|
|
>check-type</B
|
|
></A
|
|
>, <A HREF="f_typecase.html" CLASS="macref"
|
|
><B
|
|
>ctypecase</B
|
|
></A
|
|
>, <A HREF="f_abort.html" CLASS="funref"
|
|
><B
|
|
>use-value</B
|
|
></A
|
|
> (<A HREF="26_1_Glossary.html#function"
|
|
><EM CLASS="term"
|
|
>function</EM
|
|
></A
|
|
> and <A HREF="26_1_Glossary.html#restart"
|
|
><EM CLASS="term"
|
|
>restart</EM
|
|
></A
|
|
>)</P
|
|
></DD
|
|
></DL
|
|
></DIV
|
|
></DIV
|
|
><DIV CLASS="footer"
|
|
><DIV CLASS="btmnav"
|
|
><A HREF="r_muffle-warning.html" CLASS="prev"
|
|
>←</A
|
|
><A HREF="r_use-value.html" CLASS="next"
|
|
>→</A
|
|
></DIV
|
|
><DIV CLASS="trail"
|
|
>Conversion to HTML copyright 2023 by Gilbert Baumann</DIV
|
|
></DIV
|
|
></DIV
|
|
><SCRIPT
|
|
>domReady();</SCRIPT
|
|
></BODY
|
|
></HTML
|
|
> |