PageRenderTime 44ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/doc/avram.html/Computable-Error-Messages.html

https://github.com/gueststar/Avram
HTML | 166 lines | 132 code | 10 blank | 24 comment | 0 complexity | b7e725a3aa1d9ee948155b46a87dae87 MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
  2. <html>
  3. <!-- Created on December 10, 2012 by texi2html 1.82
  4. texi2html was written by:
  5. Lionel Cons <Lionel.Cons@cern.ch> (original author)
  6. Karl Berry <karl@freefriends.org>
  7. Olaf Bachmann <obachman@mathematik.uni-kl.de>
  8. and many others.
  9. Maintained by: Many creative people.
  10. Send bugs and suggestions to <texi2html-bug@nongnu.org>
  11. -->
  12. <head>
  13. <title>avram - a virtual machine code interpreter: 2.7.15.5 Computable Error Messages</title>
  14. <meta name="description" content="avram - a virtual machine code interpreter: 2.7.15.5 Computable Error Messages">
  15. <meta name="keywords" content="avram - a virtual machine code interpreter: 2.7.15.5 Computable Error Messages">
  16. <meta name="resource-type" content="document">
  17. <meta name="distribution" content="global">
  18. <meta name="Generator" content="texi2html 1.82">
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  20. <style type="text/css">
  21. <!--
  22. a.summary-letter {text-decoration: none}
  23. blockquote.smallquotation {font-size: smaller}
  24. pre.display {font-family: serif}
  25. pre.format {font-family: serif}
  26. pre.menu-comment {font-family: serif}
  27. pre.menu-preformatted {font-family: serif}
  28. pre.smalldisplay {font-family: serif; font-size: smaller}
  29. pre.smallexample {font-size: smaller}
  30. pre.smallformat {font-family: serif; font-size: smaller}
  31. pre.smalllisp {font-size: smaller}
  32. span.roman {font-family:serif; font-weight:normal;}
  33. span.sansserif {font-family:sans-serif; font-weight:normal;}
  34. ul.toc {list-style: none}
  35. -->
  36. </style>
  37. </head>
  38. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  39. <a name="Computable-Error-Messages"></a>
  40. <table cellpadding="1" cellspacing="1" border="0">
  41. <tr><td valign="middle" align="left">[<a href="Expedient-Error-Messages.html#Expedient-Error-Messages" title="Previous section in reading order"> &lt; </a>]</td>
  42. <td valign="middle" align="left">[<a href="Exception-Handler-Usage.html#Exception-Handler-Usage" title="Next section in reading order"> &gt; </a>]</td>
  43. <td valign="middle" align="left"> &nbsp; </td>
  44. <td valign="middle" align="left">[<a href="Virtual-Machine-Specification.html#Virtual-Machine-Specification" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
  45. <td valign="middle" align="left">[<a href="Exception-Handling.html#Exception-Handling" title="Up section"> Up </a>]</td>
  46. <td valign="middle" align="left">[<a href="Library-Reference.html#Library-Reference" title="Next chapter"> &gt;&gt; </a>]</td>
  47. <td valign="middle" align="left"> &nbsp; </td>
  48. <td valign="middle" align="left"> &nbsp; </td>
  49. <td valign="middle" align="left"> &nbsp; </td>
  50. <td valign="middle" align="left"> &nbsp; </td>
  51. <td valign="middle" align="left">[<a href="avram.html#Top" title="Cover (top) of document">Top</a>]</td>
  52. <td valign="middle" align="left">[<a href="avram_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
  53. <td valign="middle" align="left">[<a href="Function-Index.html#Function-Index" title="Index">Index</a>]</td>
  54. <td valign="middle" align="left">[<a href="avram_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
  55. </tr></table>
  56. <hr size="1">
  57. <a name="Computable-Error-Messages-1"></a>
  58. <h4 class="subsubsection">2.7.15.5 Computable Error Messages</h4>
  59. <p>The automatic generation and reporting of error messages provides a
  60. reasonable default behavior for applications that do not consider
  61. exceptional conditions. All applications and their input data are
  62. ordinarily members of the bottom level set in the hierarchy
  63. (<a href="A-Hierarchy-of-Sets.html#A-Hierarchy-of-Sets">A Hierarchy of Sets</a>). The error messages caused by invalid
  64. operations on this level are on the first level above the bottom, which
  65. are recognized as such and written to standard error without
  66. intervention from the application. However, there are two drawbacks to
  67. this style of dealing with exceptions.
  68. <a name="index-exceptions-3"></a>
  69. </p>
  70. <ul>
  71. <li>
  72. An application developer may wish to translate error messages
  73. into terms that are meaningful to the user, not only by literally
  74. translating them from English to the local vernacular, but perhaps by
  75. relating the particular exceptional condition to application specific
  76. causes. While it is convenient for the &ldquo;back end&rdquo; code not to be
  77. required to intervene in the error reporting, it would be most
  78. inconvenient for it not to be able to do so.
  79. </li><li>
  80. Some application specific errors might not correspond directly to any of
  81. the particular conditions detected automatically due to invalid
  82. operations, for example a semantic error in a syntactically correct
  83. input file. It might be convenient in such cases for an application to
  84. be able to define its own error messages but still have them reported
  85. automatically like the built in messages.
  86. </li></ul>
  87. <p>These situations suggest a need for some ability on the part of an
  88. application to operate on error messages themselves. Based on the
  89. operator semantics given so far, such an application is inexpressible,
  90. because for any application <code><var>f</var>_0</code> and error message
  91. <code><var>x</var>_1</code>, property <em>P44</em> stipulates <code><var>f</var>_0 <var>x</var>_1</code> =
  92. <code><var>x</var>_1</code>, meaning that the resulting error message is
  93. unchanged. Therefore, we need to define another basic property of the
  94. operator.
  95. </p>
  96. <p>The following form of virtual code is used in applications that may need
  97. to operate on error messages.
  98. <a name="index-guard"></a>
  99. </p>
  100. <dl compact="compact">
  101. <dt> <em>T32</em></dt>
  102. <dd><p>[[<code>guard</code>]] <code>(<var>f</var>,<var>g</var>)</code> = <code>((nil,<var>f</var>),<var>g</var>)</code>
  103. </p></dd>
  104. </dl>
  105. <p>Code in this form has the following semantics.
  106. </p>
  107. <dl compact="compact">
  108. <dt> <em>P53</em></dt>
  109. <dd><p>([[<code>guard</code>]] <code>(<var>f</var>,<var>g</var>)</code>)<code>_<var>n</var></code>
  110. <code><var>x</var>_<var>p</var></code> =
  111. <code><var>g</var>_(<var>n</var>+1) <var>f</var>_<var>n</var> <var>x</var>_<var>p</var></code>
  112. </p></dd>
  113. </dl>
  114. <p>The intuitive explanation is that <code><var>f</var></code> is the main part of the
  115. application, and <code><var>g</var></code> is the part of the application that
  116. operates on the error message that comes from <code><var>f</var></code> if an
  117. exception occurs while it is being evaluated (i.e., the &ldquo;exception
  118. handler&rdquo;). Typically the exception handler code implements a function
  119. that takes an error message as an argument and returns an error message
  120. as a result.
  121. </p>
  122. <p>Where there is no exception, the exception handler
  123. <code><var>g</var>_(<var>n</var>+1)</code> is never used, because its argument will be
  124. on level <code><var>n</var></code>, and therefore unaffected by an application on
  125. level <code><var>n</var>+1</code>.
  126. </p>
  127. <p>Exception handlers may have their own exception handlers, which will be
  128. invoked if the evaluation of the exception handler causes a further
  129. exception. Such an exception corresponds semantically to a value on the
  130. next level of the hierarchy of sets.
  131. </p>
  132. <hr size="1">
  133. <table cellpadding="1" cellspacing="1" border="0">
  134. <tr><td valign="middle" align="left">[<a href="Expedient-Error-Messages.html#Expedient-Error-Messages" title="Previous section in reading order"> &lt; </a>]</td>
  135. <td valign="middle" align="left">[<a href="Exception-Handler-Usage.html#Exception-Handler-Usage" title="Next section in reading order"> &gt; </a>]</td>
  136. <td valign="middle" align="left"> &nbsp; </td>
  137. <td valign="middle" align="left">[<a href="Virtual-Machine-Specification.html#Virtual-Machine-Specification" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
  138. <td valign="middle" align="left">[<a href="Exception-Handling.html#Exception-Handling" title="Up section"> Up </a>]</td>
  139. <td valign="middle" align="left">[<a href="Library-Reference.html#Library-Reference" title="Next chapter"> &gt;&gt; </a>]</td>
  140. <td valign="middle" align="left"> &nbsp; </td>
  141. <td valign="middle" align="left"> &nbsp; </td>
  142. <td valign="middle" align="left"> &nbsp; </td>
  143. <td valign="middle" align="left"> &nbsp; </td>
  144. <td valign="middle" align="left">[<a href="avram.html#Top" title="Cover (top) of document">Top</a>]</td>
  145. <td valign="middle" align="left">[<a href="avram_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
  146. <td valign="middle" align="left">[<a href="Function-Index.html#Function-Index" title="Index">Index</a>]</td>
  147. <td valign="middle" align="left">[<a href="avram_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
  148. </tr></table>
  149. <p>
  150. <font size="-1">
  151. This document was generated on <i>December 10, 2012</i> using <a href="http://www.nongnu.org/texi2html/"><i>texi2html 1.82</i></a>.
  152. </font>
  153. <br>
  154. </p>
  155. </body>
  156. </html>