bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#47677: [PATCH] condition-case success continuation


From: Stefan Monnier
Subject: bug#47677: [PATCH] condition-case success continuation
Date: Sat, 10 Apr 2021 19:52:19 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> This patch adds the condition-case handler syntax
>
>   (:success BODY)

In the tests, you might want to add one with a lambda expression which
captures a mutated success variable, as in

    (apply (condition-case res
               42
             (:success (prog1 (list (lambda (x) (+ res x)) res)
                         (setq res 0)))))

since this requires special handling in cconv.el.
Other than that, the patch looks good to me.

> Details of the syntax can be changed if there is a very good reason
> for it. Many other languages have more or less independently added
> equivalent constructs. Common Lisp's `handler-case` has a very similar
> feature (:no-error).

Any particular reason you chose ;success instead of :no-error?

> It would be nice to give `catch` the same treatment. A particularly
> flexible solution would be to add `catch` handlers to
> `condition-case`, which would then be able to handle
> everything. Unless there is a strong reason for doing it right away,
> it can be seen as a later improvement.

Let's take it one step at a time.


        Stefan






reply via email to

[Prev in Thread] Current Thread [Next in Thread]