From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Rafael D Sorkin <rsorkin@perimeterinstitute.ca>
Newsgroups: gmane.emacs.bugs
Subject: bug#59872: cl-labels and cl-flet do not comply with the documentation
Date: Wed,  7 Dec 2022 01:01:26 -0500 (EST)
Message-ID: <20221207060126.21F713400241F@mn001.pi.local>
Reply-To: Rafael D Sorkin <rsorkin@perimeterinstitute.ca>
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="31987"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: Rafael D Sorkin <rsorkin@perimeterinstitute.ca>
To: 59872@debbugs.gnu.org
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 07 07:02:24 2022
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.92)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1p2nVg-00088k-LS
	for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 07 Dec 2022 07:02:24 +0100
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces@gnu.org>)
	id 1p2nVP-0004Xv-1w; Wed, 07 Dec 2022 01:02:07 -0500
Original-Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1p2nVM-0004Xf-4t
 for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2022 01:02:04 -0500
Original-Received: from debbugs.gnu.org ([209.51.188.43])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1p2nVK-0003bq-BG
 for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2022 01:02:03 -0500
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1p2nVK-0007gc-6O
 for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2022 01:02:02 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: Rafael D Sorkin <rsorkin@perimeterinstitute.ca>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Wed, 07 Dec 2022 06:02:02 +0000
Resent-Message-ID: <handler.59872.B.167039289429538@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: report 59872
X-GNU-PR-Package: emacs
X-Debbugs-Original-To: bug-gnu-emacs@gnu.org
Original-Received: via spool by submit@debbugs.gnu.org id=B.167039289429538
 (code B ref -1); Wed, 07 Dec 2022 06:02:02 +0000
Original-Received: (at submit) by debbugs.gnu.org; 7 Dec 2022 06:01:34 +0000
Original-Received: from localhost ([127.0.0.1]:47763 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1p2nUs-0007gM-77
 for submit@debbugs.gnu.org; Wed, 07 Dec 2022 01:01:34 -0500
Original-Received: from lists.gnu.org ([209.51.188.17]:59838)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rsorkin@perimeterinstitute.ca>) id 1p2nUp-0007gF-Kp
 for submit@debbugs.gnu.org; Wed, 07 Dec 2022 01:01:33 -0500
Original-Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <rsorkin@perimeterinstitute.ca>)
 id 1p2nUp-0004VE-Cw
 for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2022 01:01:31 -0500
Original-Received: from mail-io1-xd64.google.com ([2607:f8b0:4864:20::d64])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <rsorkin@perimeterinstitute.ca>)
 id 1p2nUn-0003Vd-Qq
 for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2022 01:01:31 -0500
Original-Received: by mail-io1-xd64.google.com with SMTP id p6so2139437iod.13
 for <bug-gnu-emacs@gnu.org>; Tue, 06 Dec 2022 22:01:28 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=perimeterinstitute.ca; s=google;
 h=date:message-id:subject:cc:to:from:reply-to:from:to:cc:subject:date
 :message-id:reply-to;
 bh=zVuV1+o+Nh1s/1Xnobn9+RdUyZNQ0ePD2ES7mnkz7Rs=;
 b=mHLPK0IpFRM8gxena00smlkqcEM17x/og1eYpDnkxbU8cdRdRrAzxBVN4Nk1juYa+G
 Y/Rj5IEks6kuSYRC2Jk86q1q5gaC0DlLyn9574vmejx8NmNsDEcjWHpjIXpCR2VDOJUj
 EldH1BK746Jq/iyhZhMc1/rbBvWWk/TWXEqZB6zsiIufxHgCefeS9GkWWSXbmEPnyAhS
 gKMT2NT5NqogHFTZpF8Fu6F91yeibEBFXZBjMGPv5yyF3Pm2b/kL7YZOAsL64X1aOQLP
 aX0FYkVEOB4L9hq8QbI0t21WKJ/R3SPSAVpTTJQfnNtNMPHFIrik3AyrRBhVIl/F39dg
 20Ew==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=date:message-id:subject:cc:to:from:reply-to:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=zVuV1+o+Nh1s/1Xnobn9+RdUyZNQ0ePD2ES7mnkz7Rs=;
 b=VJCCSMnGnZOKwmQ1ewWJOxK8FA/DyfBWjvVkWcHikeRSIhh5tC4llWKY2lbmeVApKC
 ARNPWInZDQOLrAGhICK6apNkJBcoPhgZorYvFidWRsr9Fmc6I6U2nEcoimxAxsPYxu/l
 kJ9n65SkMNyN7UvNHOEPi5/v68Tzl8mGcxGpXJbywKhnSss1Xgeo14oN9QF4/X65ACxa
 uxvf03yJmwXY6zcQT5hqkKRqfpzlh5rqx0gXz2TVXHpNk43GbQwcUd0//SZgPRgWNkWE
 sOria6bc6Wu91yATtFF2Y856ioYvKRUOg4xB8y2CMqzx6RIRD0PxlVcXB8Iu56kc9HMy
 nfMw==
X-Gm-Message-State: ANoB5pkq2qo0pey1dIYJGY0jbKy5A4LDxyqFB6z9gjLu6cWTAt4JoVMc
 /j9fryrv73Jm9+k59FT8y/DLMcTlX+MDHbKY3LuIaqtHgQlFwQ==
X-Google-Smtp-Source: AA0mqf72tQql3OCmyDvLnmn9EQahAeT93e2sGAiqiaMD0IO9CXz58ag804+3JjugEf536x0End0f1IkN0tB9
X-Received: by 2002:a02:6051:0:b0:38a:3421:f2cb with SMTP id
 d17-20020a026051000000b0038a3421f2cbmr7326264jaf.308.1670392887999; 
 Tue, 06 Dec 2022 22:01:27 -0800 (PST)
Original-Received: from mail.perimeterinstitute.ca ([66.97.27.10])
 by smtp-relay.gmail.com with ESMTPS id
 u2-20020a056638134200b0038a24fa60bbsm703142jad.18.2022.12.06.22.01.26
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 06 Dec 2022 22:01:27 -0800 (PST)
X-Relaying-Domain: perimeterinstitute.ca
Original-Received: from mn001.pi.local (unknown [10.10.21.100])
 by mail.perimeterinstitute.ca (Postfix) with ESMTP id 3DCA83F08B;
 Wed,  7 Dec 2022 01:01:26 -0500 (EST)
Original-Received: by mn001.pi.local (Postfix, from userid 1254)
 id 21F713400241F; Wed,  7 Dec 2022 01:01:26 -0500 (EST)
X-Mailer: MH-E 8.6+git; nmh 1.7.1; GNU Emacs 26.3
Received-SPF: pass client-ip=2607:f8b0:4864:20::d64;
 envelope-from=rsorkin@perimeterinstitute.ca; helo=mail-io1-xd64.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Xref: news.gmane.io gmane.emacs.bugs:250163
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/250163>

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
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-