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: Richard Stallman
Subject: bug#47677: [PATCH] condition-case success continuation
Date: Fri, 23 Apr 2021 00:18:06 -0400

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > There's the business of fixing `catch` in the same way. (A new bug could be 
opened for it, but since it's intimately related we might as well do it here.) 
As mentioned, `catch` has three problems:

  > - no way to execute code when a throw is caught
  > - no way to execute code when the body terminates normally
  > - no way to catch both throws and errors

I do not agree that these are problems.  catch and throw are ok
as they are, and we should leave them alone.

catch is meant for intentional exits, and condition-case is meant for
catching errors.  If you want to handle both in one place, use both
constructs there.

If you want to do something after catch catches a throw, it is not hard
to implement that using the existing constructs.

  (if (catch 'foo
         (prog1 nil
            ...do stuff...))  ;; use (throw 'foo t) to exit
      do-if-throw
     do-if-no-throw)

given how rarely this is used, it's as easy as it needs to be, and
avoids making catch complicated.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)







reply via email to

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