when to use cl-block
over the most common let
scoping?
When a form is expected to return multiple possible values, is cl-block
the choice over let?
I believe that it's best to avoid cl-block
. There are only 23 uses
of cl-block
in the whole Emacs core. I've been writing Emacs
packages for some time and I couldn't tell at the spot what cl-block
does. A list of values is usually better, or eieio if you want complex
things.
cl-block
isn't designed for the same purpose as let
. Its purpose is to be used in macros to work with control flow in the way which resembles Common Lisp. One would use cl-block
to implement functionality of return-from
or a pattern-matching device with guards etc. It's not expected that non-library code would use this macro.
cl-block
andlet
did similar things?