0

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?

1
  • 2
    Can you please elaborate on what gave you the impression that cl-block and let did similar things?
    – phils
    Commented Feb 25, 2015 at 22:03

2 Answers 2

3

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.

3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.