GNU bug report logs - #77612
[PATCH] (eieio-backward-compatibility): Change default to new `warn` value

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Mon, 7 Apr 2025 17:31:01 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 77612 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to monnier <at> iro.umontreal.ca, zappo <at> gnu.org, bug-gnu-emacs <at> gnu.org:
bug#77612; Package emacs. (Mon, 07 Apr 2025 17:31:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
New bug report received and forwarded. Copy sent to monnier <at> iro.umontreal.ca, zappo <at> gnu.org, bug-gnu-emacs <at> gnu.org. (Mon, 07 Apr 2025 17:31:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] (eieio-backward-compatibility): Change default to new `warn`
 value
Date: Mon, 07 Apr 2025 13:29:35 -0400
[Message part 1 (text/plain, inline)]
Tags: patch

See commit message below.  I also encourage everyone to set
`eieio-backward-compatibility` to nil in their `.emacs`.


        Stefan

 In GNU Emacs 31.0.50 (build 2, i686-pc-linux-gnu, GTK+ Version 3.24.48,
 cairo version 1.18.2) of 2025-03-15 built on alfajor
Repository revision: 4a378e3b325ff3cb84307a2ff4d05ab9ffe24905
Repository branch: work
Windowing system distributor 'The X.Org Foundation', version 11.0.12101015
System Description: Debian GNU/Linux trixie/sid

Configured using:
 'configure -C --enable-checking --enable-check-lisp-object-type --with-modules --with-cairo --with-tiff=ifavailable
 'CFLAGS=-Wall -g3 -Og -Wno-pointer-sign'
 PKG_CONFIG_PATH=/home/monnier/lib/pkgconfig'

[0001-eieio-backward-compatibility-Change-default-to-new-w.patch (text/patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77612; Package emacs. (Mon, 07 Apr 2025 22:37:02 GMT) Full text and rfc822 format available.

Message #8 received at 77612 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: 77612 <at> debbugs.gnu.org
Cc: "Eric M. Ludlam" <zappo <at> gnu.org>
Subject: Re: bug#77612: [PATCH] (eieio-backward-compatibility): Change
 default to new `warn` value
Date: Mon, 07 Apr 2025 18:36:19 -0400
> `eieio-backward-compatibility` controls compatibility with
> features declared obsolete since Emacs-25.  I'm not sure
> we're ready to remove support for those features (i.e. to set
> `eieio-backward-compatibility` to nil), so instead I suggest
> to make uses of those features emit warnings not only at
> compile-time but also at run-time.

I forgot to add the same treatment for the (ab)use of initargs as slot
names (also deprecated since Emacs-25), so I'd suggest adding the patch
below to the previous one.


        Stefan


diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el
index 7d0fd643056..d608517e671 100644
--- a/lisp/emacs-lisp/eieio-core.el
+++ b/lisp/emacs-lisp/eieio-core.el
@@ -913,12 +913,15 @@
   (let* ((fsi (gethash slot (cl--class-index-table class))))
     (if (integerp fsi)
         fsi
+      (when eieio-backward-compatibility
       (let ((fn (eieio--initarg-to-attribute class slot)))
-	(if fn
+	  (when fn
+            (when (eq eieio-backward-compatibility 'warn)
+              (message "Accessing slot `%S' via obsolete initarg name `%S'"
+                       fn slot))
             ;; Accessing a slot via its :initarg is accepted by EIEIO
             ;; (but not CLOS) but is a bad idea (for one: it's slower).
-            (eieio--slot-name-index class fn)
-          nil)))))
+            (eieio--slot-name-index class fn)))))))
 
 (defun eieio--class-slot-name-index (class slot)
   "In CLASS find the index of the named SLOT.






This bug report was last modified 5 days ago.

Previous Next


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