GNU bug report logs - #75498
31.0.50; cl-block is not lexically scoped

Previous Next

Package: emacs;

Reported by: Ihor Radchenko <yantar92 <at> posteo.net>

Date: Sat, 11 Jan 2025 16:09:01 UTC

Severity: normal

Found in version 31.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#75498: closed (31.0.50; cl-block is not lexically scoped)
Date: Thu, 16 Jan 2025 22:50:01 +0000
[Message part 1 (text/plain, inline)]
Your message dated Thu, 16 Jan 2025 17:48:59 -0500
with message-id <jwved12v0hk.fsf-monnier+emacs <at> gnu.org>
and subject line Re: bug#75498: 31.0.50; cl-block is not lexically scoped
has caused the debbugs.gnu.org bug report #75498,
regarding 31.0.50; cl-block is not lexically scoped
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
75498: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=75498
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Ihor Radchenko <yantar92 <at> posteo.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 31.0.50; cl-block is not lexically scoped
Date: Sat, 11 Jan 2025 16:10:39 +0000
According to the docstring, `cl-block' should be lexically scoped:

    Code inside the BODY forms can call cl-return-from
    to jump prematurely out of the block.  This differs from catch and throw
    in two respects:  First, the NAME is an unevaluated symbol rather than a
    quoted symbol or other form; and second, NAME is lexically rather than
    dynamically scoped:  Only references to it within BODY will work.  These
    references may appear inside macro expansions, but not inside functions
    called from BODY.

But try the following reproducer:

1. create file test.el

;; -*- lexical-binding: t; -*-

(defun return-from-x ()
  (cl-return-from x 'dynamic))

(defun x-block ()
  (cl-block x
    (return-from-x)
    (cl-return-from x 'lexical)))

2. (load "/path/to/test.el)
3. M-: (x-block)

Expected: 'lexical is returned.
Observed: 'dynamic is returned.

In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.42, cairo version 1.18.2) of 2025-01-10 built on localhost
Repository revision: e8deac66adef279a15c806d7547a7610b0189795
Repository branch: scratch/igc
Windowing system distributor 'The X.Org Foundation', version 11.0.12101014
System Description: Gentoo Linux

Configured using:
 'configure --with-mps=yes --with-native-compilation 'CFLAGS=-g3
 -I/opt/mps/include -L/opt/mps/lib'
 JAVAC=/etc/java-config-2/current-system-vm/bin/javac
 PKG_CONFIG_PATH=/usr/share/guile-data/3.0/pkgconfig'

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


[Message part 3 (message/rfc822, inline)]
From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 75498-done <at> debbugs.gnu.org, eliz <at> gnu.org, yantar92 <at> posteo.net
Subject: Re: bug#75498: 31.0.50; cl-block is not lexically scoped
Date: Thu, 16 Jan 2025 17:48:59 -0500
>> Has somebody recompiled Emacs with the patch installed and looked for
>> such new compiler warnings?
> I just checked: there are no new compiler warnings when the patch is
> installed.

Thanks, pushed to `master`.


        Stefan



This bug report was last modified 129 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.