summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kyheku <kaz@kylheku.com>2020-01-30 00:05:40 -0800
committerKaz Kylheku <kaz@kylheku.com>2020-01-30 00:05:40 -0800
commita6e837526bf5052ef6292860784b786e5c720f0a (patch)
treef553d7e3bf6c3a67805daab2f3cd6b6633b0b8d4
parentf7b694183157b674abf68df1b830cadd93e18cdd (diff)
downloadtxr-a6e837526bf5052ef6292860784b786e5c720f0a.tar.gz
txr-a6e837526bf5052ef6292860784b786e5c720f0a.tar.bz2
txr-a6e837526bf5052ef6292860784b786e5c720f0a.zip
New retry and skip exceptions under restart hierarchy.
* unwind.c (uw_late_init): Register retry and skip symbols as exception subtypes of restart. * txr.1: Document retry and skip restarts.
-rw-r--r--txr.119
-rw-r--r--unwind.c2
2 files changed, 20 insertions, 1 deletions
diff --git a/txr.1 b/txr.1
index f8a4d0f1..7575b05c 100644
--- a/txr.1
+++ b/txr.1
@@ -40960,7 +40960,11 @@ subtype of every exception type:
.verb
t ----+--- warning
|
- +--- restart --- continue
+ +--- restart ---+--- continue
+ | |
+ | +--- retry
+ | |
+ | +--- skip
|
+--- error ---+--- type-error
|
@@ -41004,6 +41008,19 @@ type. The
type is intended to be the root of a hierarchy of exception
types used for denoting restart points: designers are encouraged
to derive restarts from this type.
+A catch for the
+.code continue
+exception should be established around constructs which can throw an
+error from which it is possible to recover. That exception provides
+the entry point into the recovery which resumes execution.
+A catch for
+.code retry
+should be provided in situations when it is possible and makes sense for a failed
+operation to be tried again.
+A catch for
+.code skip
+should be provided in situations when it is possible and sensible to continue
+with subsequent operations even though an operation has failed.
.NP* Dialect Notes
diff --git a/unwind.c b/unwind.c
index 0ac44798..478ac5a4 100644
--- a/unwind.c
+++ b/unwind.c
@@ -1314,6 +1314,8 @@ void uw_late_init(void)
reg_fun(intern(lit("find-frames-by-mask"), user_package), func_n1(uw_find_frames_by_mask));
#endif
uw_register_subtype(continue_s, restart_s);
+ uw_register_subtype(intern(lit("retry"), user_package), restart_s);
+ uw_register_subtype(skip_s, restart_s);
uw_register_subtype(warning_s, t);
uw_register_subtype(defr_warning_s, warning_s);
}