From d817b323e04fa8598578508a668b49fd51953fc6 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 3 Nov 2009 16:42:44 -0800 Subject: Fixed misleading wording (separation versus termination). Added Introduction headings to some major sections. Improved exception handling intro. --- ChangeLog | 4 +++- txr.1 | 41 ++++++++++++++++++++++++----------------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index d40da1a5..b9a51e0c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2009-10-22 Kaz Kylheku - * txr.1: Fix misleading wording (separation versus termination). + * txr.1: Fixed misleading wording (separation versus termination). + Added Introduction headings to some major sections. + Improved exception handling intro. 2009-10-22 Kaz Kylheku diff --git a/txr.1 b/txr.1 index 391c5fdf..6b7a4552 100644 --- a/txr.1 +++ b/txr.1 @@ -2023,6 +2023,8 @@ local definition. When @(which) is called directly from the top level, its .SH OUTPUT +.SS Introduction + A .B txr query may perform custom output. Output is performed by @(output) clauses, @@ -2240,25 +2242,30 @@ instead of the main clause: it is produced with no trailing space. .SH EXCEPTIONS +.SS Introduction + The exceptions mechanism in .B txr -is disciplined way for representing and handling abnormal situations that may -occur during query processing, such as using an unbound variable, or attempting -to open a nonexistent file. - -An exception is a situation in the query which stops the query and -demands handling. If handling is not provided for that exception, -the execution of the program is terminated. - -An exception is always identified by a symbol, which is its type. Types are -organized in a subtype-supertype hierarchy. For instance, the file_error -exception type is a subtype of the error type. This means that a file error is -a kind of error. An exception handling block which catches exceptions of type -error will catch exceptions of type file_error, but a block which catches -file_error will not catch all exceptions of type error. A query_error is a kind -of error, but not a kind of file_error. The symbol t is the supertype -of every type: every exception type is considered to be a kind of t. -(Mnemonic: t stands for type, as in any type). +is another disciplined form of non-local transfer, in addition to the blocks +mechanism (see BLOCKS above). Like blocks, exceptions provide a construct +which serves as the target for a dynamic exit. Both blocks and exceptions +can be used to bail out of deep nesting when some condition occurs. +However, exceptions provide more complexity. Exceptions are useful for +error handling, and txr in fact maps certain error situations to exception +control transfers. However, exceptions are not inherently an error-handling +mechanism; they are a structured dynamic control transfer mechanism, one +of whose applications is error handling. + +An exception control transfer (simply called an exception) is always identified +by a symbol, which is its type. Types are organized in a subtype-supertype +hierarchy. For instance, the file_error exception type is a subtype of the +error type. This means that a file error is a kind of error. An exception +handling block which catches exceptions of type error will catch exceptions of +type file_error, but a block which catches file_error will not catch all +exceptions of type error. A query_error is a kind of error, but not a kind of +file_error. The symbol t is the supertype of every type: every exception type +is considered to be a kind of t. (Mnemonic: t stands for type, as in any +type). Exceptions are handled using @(catch) clauses within a @(try) directive. -- cgit v1.2.3