GNU bug report logs -
#62959
[PATCH] Recognize defstruct slot names in various eieio functions
Previous Next
Reported by: Thuna <thuna.cing <at> gmail.com>
Date: Wed, 19 Apr 2023 22:17:02 UTC
Severity: normal
Tags: patch
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Wed, 03 May 2023 14:47:10 +0300
with message-id <837ctpmybl.fsf <at> gnu.org>
and subject line Re: bug#62959: [PATCH] Recognize defstruct slot names in various eieio functions
has caused the debbugs.gnu.org bug report #62959,
regarding [PATCH] Recognize defstruct slot names in various eieio functions
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
62959: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62959
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
[Message part 3 (text/plain, inline)]
The function `eieio--known-slot-name-p' is used by some eieio functions
(specifically eieio-oref, eieio-oref-default, and eieio-oset-default) to
check whether a slot name is known or not, and if not signals an
"Unknown slot" warning.
Structs do not make their slots known to `eieio--known-slot-name-p', so
the warning is signaled even for valid slot names. Since eieio aims for
compatibility with defstruct, this should probably be considered a bug.
The function `eieio--known-slot-name-p' checks the variable
`eieio--known-slot-names' but also has a fallback for the name's
`slot-name' property. In the patch I opted to use the latter.
[0001-Recognize-defstruct-slot-names-in-various-eieio-func.patch (text/x-patch, attachment)]
[Message part 5 (message/rfc822, inline)]
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: Thuna <thuna.cing <at> gmail.com>, 62959 <at> debbugs.gnu.org
> Date: Tue, 02 May 2023 16:48:02 -0400
>
> >> diff --git a/lisp/emacs-lisp/cl-preloaded.el b/lisp/emacs-lisp/cl-preloaded.el
> >> index 9445093f143..5235be52996 100644
> >> --- a/lisp/emacs-lisp/cl-preloaded.el
> >> +++ b/lisp/emacs-lisp/cl-preloaded.el
> >> @@ -176,6 +176,7 @@ cl-struct-define
> >> (i 0)
> >> (offset (if type 0 1)))
> >> (dolist (slot slots)
> >> + (put (car slot) 'slot-name t)
> >> (let* ((props (cl--plist-to-alist (cddr slot)))
> >> (typep (assq :type props))
> >> (type (if (null typep) t
> >> --
> >> 2.39.2
> >>
> >
> > Stefan, any comments?
>
> LGTM, thanks,
Thanks, installed on the emacs-29 branch, and closing.
This bug report was last modified 2 years and 16 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.