all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#59872: cl-labels and cl-flet do not comply with the documentation
@ 2022-12-07  6:01 Rafael D Sorkin
  2022-12-10 23:12 ` Michael Heerdegen
  0 siblings, 1 reply; 2+ messages in thread
From: Rafael D Sorkin @ 2022-12-07  6:01 UTC (permalink / raw)
  To: 59872; +Cc: Rafael D Sorkin

Hi,

The documentation that I received along with emacs 28.2 says
about `cl-flet' that 

  "... the function body is enclosed in an implicit block as if by `cl-defun'".  

(This is from     
   File: cl.info,  Node: Function Bindings,  Next: Macro Bindings,  Prev: Dynamic Bindings,  Up: Variable Bindings
   4.3.2 Function Bindings
   -----------------------)

I expected this behavior precisely because of the parallel with
`cl-defun', as well as the connotation of the prefix "cl-"
itself, which leads on to expect that `cl-flet' and `cl-labels'
would act like their CL counterparts.

However, as far as I can tell, neither of these functions
actually creates an implicit named block, as claimed.
Below is the evidence (from emacs 26.3, but 28.2 is similar).
One sees that only `flet' works, but it has been declared as
"obsolete".


Thanks,
Rafael

emacs-version                                              ; 26.3
(require 'cl-lib)                                          ; cl-lib

(flet     ((tester () (return-from tester 3)))   (tester)) ; 3
(labels   ((tester () (return-from tester 3)))   (tester)) ; No catch for tag: --cl-block-tester--, 3
(cl-flet  ((tester () (return-from tester 3)))   (tester)) ; No catch for tag: --cl-block-tester--, 3
(cl-labels((tester () (return-from tester 3)))   (tester)) ; No catch for tag: --cl-block-tester--, 3

(Macroexpand '(cl-labels ((tester () (return-from tester 3))))) ; (let (#:--cl-tester--) (setq #:--cl-tester-- (function (lambda nil (throw (quote --cl-block-tester--) 3)))))

(Macroexpand '(cl-flet   ((tester () (return-from tester 3))))) ; (let* ((#:--cl-tester-- (cl-function (lambda nil (return-from tester 3))))) (progn))

(Macroexpand '(labels  ((tester () (return-from tester 3))))) ; (progn (defvar #:--cl---cl-tester----) (let ((#:--cl---cl-tester---- nil)) (let* ((#:v (quote #:--cl---cl-tester----))) (set #:v (function (lambda nil (throw (quote --cl-block-tester--) 3)))))))

(Macroexpand '(flet     ((tester () (return-from tester 3))))) ; (let* ((#:vnew (cl-function (lambda nil (cl-block tester (return-from tester 3))))) (#:old (symbol-function (quote tester)))) (unwind-protect (fset (quote tester) #:vnew) (fset (quote tester) #:old)))

~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
 Rafael Sorkin
 Perimeter Institute for Theoretical Physics
 31 Caroline Street North
 Waterloo, ON  N2L 2Y5
 Canada
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#59872: cl-labels and cl-flet do not comply with the documentation
  2022-12-07  6:01 bug#59872: cl-labels and cl-flet do not comply with the documentation Rafael D Sorkin
@ 2022-12-10 23:12 ` Michael Heerdegen
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Heerdegen @ 2022-12-10 23:12 UTC (permalink / raw)
  To: Rafael D Sorkin; +Cc: 59872

Rafael D Sorkin <rsorkin@perimeterinstitute.ca> writes:

> The documentation that I received along with emacs 28.2 says about
> `cl-flet' that
>
> "... the function body is enclosed in an implicit block as if by
> `cl-defun'".

> However, as far as I can tell, neither of these functions
> actually creates an implicit named block, as claimed.

I think you are absolutely right, thanks for reporting this.  Seems
implementing that feature had just been forgotten when the cl-lib
versions were written.

Michael.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-10 23:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-07  6:01 bug#59872: cl-labels and cl-flet do not comply with the documentation Rafael D Sorkin
2022-12-10 23:12 ` Michael Heerdegen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.