GNU bug report logs - #68075
30.0.50; New special form `handler-bind`

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Thu, 28 Dec 2023 06:34:01 UTC

Severity: normal

Found in version 30.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #20 received at 68075 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 68075 <at> debbugs.gnu.org
Subject: Re: bug#68075: 30.0.50; New special form `handler-bind`
Date: Thu, 28 Dec 2023 17:04:45 -0500
>> I'm trying to explain that when looking for a handler, we look both for
>> condition-case handler and handler-bind handlers and we use whichever is
>> "closest", i.e. more deeply nested.  So just like a local
>> `condition-case` overrides temporarily an outer one, the same holds not
>> only among `handler-bind`s but also between `condition-case` and
>> `handler-bind` as well.
>
> Then, it would also make sense to make `condition-case' and
> `handler-bind' refer to each other from the docstrings.

BTW, `condition-case` can be implemented as a macro on top of
`handler-bind` and `catch`, e.g.

    (condition-case ERR FORM (error HANDLER))

can become something like:

    (let* ((tag (cons nil nil))
           (ERR (catch tag
                  (handler-bind ((error (lambda (err) (throw tag err))))
                    (cons 'noerror FORM)))))
      (if (eq 'noerror (car ERR))
          (cdr ERR)
        HANDLER))

:-)


-- Stefan





This bug report was last modified 1 year and 139 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.