[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Various Decisions
- To: Common-lisp-object-system@SAIL.STANFORD.EDU
- Subject: Various Decisions
- From: Dick Gabriel <RPG@SAIL.STANFORD.EDU>
- Date: 29 Sep 87 1529 PDT
On condition handlers instead of NEXT-METHOD:
It seems that condition handlers are an appropriate vehicle for dealing
with exceptional conditions, or at least with conditions that are not
routinely encountered. For example, in a Lisp in which CAR and CDR of NIL
signal errors, one would be surprised to see the naive SUBST function
written like this:
(defun subst (x y z)
(cond ((eq x z) y)
(t (cons (subst x y (car z))
(subst x y (cdr z))))))
with condition handlers for the null and non-CONS cases.
Similarly, if it is the case (and I think it likely) that a programmer
frequently wants to CALL-NEXT-METHOD when there might not be one, then he
will likely want to write:
(when (next-method) (call-next-method))
or use a non-error-signaling version of CALL-NEXT-METHOD rather than
program a condition handler.
-rpg-