r7rs-small-texinfo

Unnamed repository; edit this file 'description' to name the repository.
git clone https://kaka.farm/~git/r7rs-small-texinfo
Log | Files | Refs

commit f2ceb7586f272a4a7b547645ae2a2f8668b33a72
parent ac6ad05973606e7aa034ba7efe231d4c74971a96
Author: Wolfgang Corcoran-Mathe <wcm@sigwinch.xyz>
Date:   Sun,  4 Feb 2024 21:56:22 -0500

Exceptions (procedural): Texify.

Diffstat:
Mdoc/r7rs-small/procedures/exceptions.texinfo | 107++++++++++++++++++++++++++++++++++++++++---------------------------------------
1 file changed, 54 insertions(+), 53 deletions(-)

diff --git a/doc/r7rs-small/procedures/exceptions.texinfo b/doc/r7rs-small/procedures/exceptions.texinfo @@ -2,10 +2,11 @@ @section Exceptions This section describes Scheme's exception-handling and exception-raising procedures. -For the concept of Scheme exceptions, see section 1.3.2. See also 4.2.7 for the guard +For the concept of Scheme exceptions, see @ref{Error situations and unspecified behavior}. +See also @ref{Exception handling} for the @code{guard} syntax. -Exception handlers are one-argument procedures that determine the action the program +@dfn{Exception handlers} are one-argument procedures that determine the action the program takes when an exceptional situation is signaled. The system implicitly maintains a current exception handler in the dynamic environment. @@ -16,20 +17,13 @@ exception. @deffn procedure with-exception-handler handler thunk -It is an error if +It is an error if @var{handler} does not accept one argument. +It is also an error if @var{thunk} does not accept zero arguments. -handler does not accept one argument. It is also an error if - -thunk does not accept zero arguments. - -The with-exception-handler procedure returns the results of invoking - -thunk. - -Handler is installed as the current exception handler in the dynamic environment used -for the invocation of - -thunk. +The @code{with-exception-handler} procedure returns the results of invoking +@var{thunk}. @var{Handler} is installed as the current +exception handler +in the dynamic environment used for the invocation of @var{thunk}. @lisp (call-with-current-continuation @@ -42,41 +36,45 @@ thunk. (k 'exception)) (lambda () (+ 1 (raise 'an-error)))))) - @result{} exception - and prints condition: an-error + @result{} @r{exception} + @print{} condition: an-error (with-exception-handler (lambda (x) (display "something went wrong\n")) (lambda () (+ 1 (raise 'an-error)))) - prints - something went wrong After printing, - the second example then raises another exception. + @print{} something went wrong @end lisp + +After printing,the second example then raises another exception. + @end deffn @deffn procedure raise obj -Raises an exception by invoking the current exception handler on - -obj. The handler is called with the same dynamic environment as that of the call to raise, -except that the current exception handler is the one that was in place when the handler -being called was installed. If the handler returns, a secondary exception is raised in the -same dynamic environment as the handler. The relationship between +Raises an exception by invoking the current exception +handler on @var{obj}. The handler is called with the same +dynamic environment as that of the call to @code{raise}, except that +the current exception handler is the one that was in place when the +handler being called was installed. If the handler returns, a secondary +exception is raised in the same dynamic environment as the handler. +The relationship between @var{obj} and the object raised by +the secondary exception is unspecified. -obj and the object raised by the secondary exception is unspecified. @end deffn @deffn procedure raise-continuable obj -Raises an exception by invoking the current exception handler on - -obj. The handler is called with the same dynamic environment as the call to -raise-continuable, except that: (1) the current exception handler is the one that was in -place when the handler being called was installed, and (2) if the handler being called -returns, then it will again become the current exception handler. If the handler returns, -the values it returns become the values returned by the call to raise-continuable. +Raises an exception by invoking the current +exception handler on @var{obj}. The handler is called with +the same dynamic environment as the call to +@code{raise-continuable}, except that: (1) the current +exception handler is the one that was in place when the handler being +called was installed, and (2) if the handler being called returns, +then it will again become the current exception handler. If the +handler returns, the values it returns become the values returned by +the call to @code{raise-continuable}. @lisp (with-exception-handler @@ -90,21 +88,21 @@ the values it returns become the values returned by the call to raise-continuabl (lambda () (+ (raise-continuable "should be a number") 23))) - prints: should be a number - @result{} 65 + @print{} should be a number + @result{} 65 @end lisp -@end deffn - -@deffn procedure error message obj @dots{} -Message should be a string. +@end deffn -Raises an exception as if by calling raise on a newly allocated implementation-defined -object which encapsulates the information provided by +@deffn procedure error message obj@dots{} -message, as well as any +@var{Message} should be a string. -objs, known as the irritants. The procedure error-object? must return #t on such objects. +Raises an exception as if by calling +@code{raise} on a newly allocated implementation-defined object which encapsulates +the information provided by @var{message}, +as well as any @var{obj}s, known as the @dfn{irritants}. +The procedure @code{error-object?} must return @code{#t} on such objects. @lisp (define (null-list? l) @@ -119,32 +117,35 @@ objs, known as the irritants. The procedure error-object? must return #t on such @deffn procedure error-object? obj -Returns #t if +Returns @code{#t} if @var{obj} is an object created by @code{error} +or one of an implementation-defined set of objects. Otherwise, it returns +@code{#f}. +The objects used to signal errors, including those which satisfy the +predicates @code{file-error?} and @code{read-error?}, may or may not +satisfy @code{error-object?}. -obj is an object created by error or one of an implementation-defined set of objects. -Otherwise, it returns #f. The objects used to signal errors, including those which satisfy -the predicates file-error? and read-error?, may or may not satisfy error-object?. @end deffn @deffn procedure error-object-message error-object Returns the message encapsulated by +@var{error-object}. -error-object. @end deffn @deffn procedure error-object-irritants error-object Returns a list of the irritants encapsulated by +@var{error-object}. -error-object. @end deffn @deffn procedure read-error? obj @deffnx procedure file-error? obj -Error type predicates. Returns #t if +Error type predicates. Returns @code{#t} if @var{obj} is an +object raised by the @code{read} procedure or by the inability to open +an input or output port on a file, respectively. Otherwise, it +returns @code{#f}. -obj is an object raised by the read procedure or by the inability to open an input or -output port on a file, respectively. Otherwise, it returns #f. @end deffn