diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-09-05 14:30:10 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-10-23 10:51:30 -0700 |
commit | 9f283262438bb0656870648f5a2f7bedae4d1030 (patch) | |
tree | 77e8cc6cc36b49800cf799aac95d25a426b6326f /src/util.lisp | |
parent | 80b5cb9cea4a4d56455661678d896514312109eb (diff) | |
download | consfigurator-9f283262438bb0656870648f5a2f7bedae4d1030.tar.gz |
add SKIP-SEQUENCE, ABORTED-CHANGE, ESEQPROPS-UNTIL
We establish a SKIP-PROPERTY restart for each sequencing combinator, such that
in addition to skipping over individual property applications, it is possible
to abandon the whole sequence. However, that restart discards information
about whether or not a change was made by the property applications of the
abandoned sequence prior to the property application interrupted by an error.
The new SKIP-SEQUENCE restart preserves this information by returning from the
DOLIST in APPLY-AND-PRINT.
The implementation of the SKIP-SEQUENCE restart must take into account the
fact that the property application interrupted by the error might have made a
change prior to failing. In particular, the new restart must not cause the
sequencing combinator to return :NO-CHANGE unless it can infer that the
property application interrupted by an error made no change. To achieve this,
capture whether the interrupted property application made a change by
introducing a distinction between plain FAILED-CHANGE and a new condition
class, ABORTED-CHANGE.
These changes permit the implementation of a new combinator, ESEQPROPS-UNTIL,
which invokes SKIP-SEQUENCE when a given condition is signalled. The new
combinator is like SEQPROPS in that it allows for continuing the deployment
despite a signalling of FAILED-CHANGE, but it is like ESEQPROPS in not
attempting to apply succeeding propapps. It also offers finer-grained control
over what kinds of failures are to be tolerated than does SEQPROPS. When the
condition is ABORTED-CHANGE or a subclass, ESEQPROPS-UNTIL returns information
about whether or not a change was made by the property applications of the
abandoned sequence prior to the property application that was interrupted,
enabling useful combinations with ON-CHANGE.
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/util.lisp')
-rw-r--r-- | src/util.lisp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util.lisp b/src/util.lisp index f23cfb0..487fcd4 100644 --- a/src/util.lisp +++ b/src/util.lisp @@ -149,9 +149,9 @@ supported." (nreversef ,argsym) ,@forms))))) -(defmacro define-simple-error (name &optional docstring) +(defmacro define-simple-error (name &optional parent-types docstring) `(progn - (define-condition ,name (simple-error) () + (define-condition ,name (,@parent-types simple-error) () ,@(and docstring `((:documentation ,docstring)))) (defun ,name (message &rest args) ,@(and docstring `(,docstring)) |