klisp

an open source interpreter for the Kernel Programming Language.
git clone http://git.hanabi.in/repos/klisp.git
Log | Files | Refs | README

Errors.html (4275B)


      1 <html lang="en">
      2 <head>
      3 <title>Errors - klisp Reference Manual</title>
      4 <meta http-equiv="Content-Type" content="text/html">
      5 <meta name="description" content="klisp Reference Manual">
      6 <meta name="generator" content="makeinfo 4.13">
      7 <link title="Top" rel="start" href="index.html#Top">
      8 <link rel="prev" href="Bytevectors.html#Bytevectors" title="Bytevectors">
      9 <link rel="next" href="Libraries.html#Libraries" title="Libraries">
     10 <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
     11 <meta http-equiv="Content-Style-Type" content="text/css">
     12 <style type="text/css"><!--
     13   pre.display { font-family:inherit }
     14   pre.format  { font-family:inherit }
     15   pre.smalldisplay { font-family:inherit; font-size:smaller }
     16   pre.smallformat  { font-family:inherit; font-size:smaller }
     17   pre.smallexample { font-size:smaller }
     18   pre.smalllisp    { font-size:smaller }
     19   span.sc    { font-variant:small-caps }
     20   span.roman { font-family:serif; font-weight:normal; } 
     21   span.sansserif { font-family:sans-serif; font-weight:normal; } 
     22 --></style>
     23 <link rel="stylesheet" type="text/css" href="css/style.css">
     24 </head>
     25 <body>
     26 <div class="node">
     27 <a name="Errors"></a>
     28 <p>
     29 Next:&nbsp;<a rel="next" accesskey="n" href="Libraries.html#Libraries">Libraries</a>,
     30 Previous:&nbsp;<a rel="previous" accesskey="p" href="Bytevectors.html#Bytevectors">Bytevectors</a>,
     31 Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
     32 <hr>
     33 </div>
     34 
     35 <!-- node-name,  next,  previous,  up -->
     36 <h2 class="chapter">20 Errors</h2>
     37 
     38 <p><a name="index-Errors-389"></a>
     39 An error object contains information that can be used to describe an
     40 error that occured in the klisp system.  The interpreter will pass an
     41 error object to an error continuation whenever it needs to signal that
     42 an error occured while executing a program or evaluating an
     43 expression.
     44 
     45    <p>An error object contains a message describing the situation and a
     46 (possibly empty) list of objects, called its irritants, that provide
     47 some context or additional info depending on the error condition.  The
     48 error type is encapsulated.
     49 
     50    <p>Notice that unlike in most other languages, the error object in klisp
     51 isn't used to classify the error in error handlers, the error
     52 continuation being passed the error object is used for that.  The
     53 error object is used only to convey additional info, not the type of
     54 error.
     55 
     56    <p>SOURCE NOTE: The type of object passed to the error continuation is
     57 not specified in the Kernel Report.  This type was inspired by r7rs
     58 scheme.
     59 
     60 <div class="defun">
     61 &mdash; Applicative: <b>error-object?</b> (<var>error-object? . objs</var>)<var><a name="index-error_002dobject_003f-390"></a></var><br>
     62 <blockquote><p>The primitive type predicate for type error.  <code>error-object?</code>
     63 returns true iff all the objects in <code>objects</code> are of type
     64 error. 
     65 </p></blockquote></div>
     66 
     67 <div class="defun">
     68 &mdash; Applicative: <b>error</b> (<var>error msg . objs</var>)<var><a name="index-error-391"></a></var><br>
     69 <blockquote><p>Create an error object with message <code>msg</code> and irritants the list
     70 of objects <code>objs</code> and then send that error object to the error
     71 continuation.  This is the recommended way to signal an error in
     72 klisp. 
     73 </p></blockquote></div>
     74 
     75 <div class="defun">
     76 &mdash; Applicative: <b>raise</b> (<var>raise obj</var>)<var><a name="index-raise-392"></a></var><br>
     77 <blockquote><p>Send <code>obj</code> to the error continuation.  <code>obj</code> needs not be an
     78 error object, any kind of object can be sent to the error continuation
     79 (but that's not recommended!). 
     80 </p></blockquote></div>
     81 
     82 <div class="defun">
     83 &mdash; Applicative: <b>error-object-message</b> (<var>error-object-message error</var>)<var><a name="index-error_002dobject_002dmessage-393"></a></var><br>
     84 <blockquote><p>Applicative <code>error-object-message</code> extracts the message of
     85 <code>error</code>. 
     86 </p></blockquote></div>
     87 
     88 <div class="defun">
     89 &mdash; Applicative: <b>error-object-irritants</b> (<var>error-object-irritants error</var>)<var><a name="index-error_002dobject_002dirritants-394"></a></var><br>
     90 <blockquote><p>Applicative <code>error-object-irritants</code> extracts the irritants of
     91 <code>error</code>. 
     92 </p></blockquote></div>
     93 
     94 <!-- *-texinfo-*- -->
     95    </body></html>
     96