emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#66938: closed (30.0.50 [PATCH]: Make EIEIO :accessor behave like :re


From: GNU bug Tracking System
Subject: bug#66938: closed (30.0.50 [PATCH]: Make EIEIO :accessor behave like :reader when reading a slot's value)
Date: Sun, 26 Nov 2023 13:53:03 +0000

Your message dated Sun, 26 Nov 2023 08:52:19 -0500
with message-id <jwvo7fgy64j.fsf-monnier+emacs@gnu.org>
and subject line Re: bug#66938: 30.0.50 [PATCH]: Make EIEIO :accessor behave 
like :reader when reading a slot's value
has caused the debbugs.gnu.org bug report #66938,
regarding 30.0.50 [PATCH]: Make EIEIO :accessor behave like :reader when 
reading a slot's value
to be marked as done.

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


-- 
66938: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=66938
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: 30.0.50 [PATCH]: Make EIEIO :accessor behave like :reader when reading a slot's value Date: Sat, 4 Nov 2023 18:03:06 -0400
Hope everyone is well.

I've included a suggested patch for 'eieio.el', which slightly
modifies the behavior of EIEIO's 'defclass'. When playing around with
'eieio-instance-inheritor' as a base class, I noticed that calls to
the accessor (when used as a getter) weren't delegating to the parent
instance (as defined when calling 'clone'). That is, an object clone that doesn't set
its fields directly will report 'nil' when the accessor method is used as a getter for some slot.

However, neither 'oref' nor ':reader' methods share this problem.

The included patch duplicates the code for the reader method defined for
the ':reader' case. In particular, it removes the 'slot-unboundp' check, which appeared 
to be the real culprit here. I've also deleted the FIXME comment which asked, "Why is this 
different from the :reader case?" since it no longer differs from it.

There is some more context provided (along with an example) in the
commit message included in the patch, in case it helps.

I know this isn't earth-shattering, but I couldn't help but notice the issue;
and, at least to me, it seemed like incorrect behavior. (Otherwise, in order to
obtain the delegation behavior for a given slot, I'd be forced to define
 ':reader' and ':writer' separately, which feels rather verbose, given we have ':accessor'
for this exact purpose.)

- Brandon





Attachment: 0001-Make-EIEIO-accessor-behave-like-reader-when-reading.patch
Description: Text Data


--- End Message ---
--- Begin Message --- Subject: Re: bug#66938: 30.0.50 [PATCH]: Make EIEIO :accessor behave like :reader when reading a slot's value Date: Sun, 26 Nov 2023 08:52:19 -0500 User-agent: Gnus/5.13 (Gnus v5.13)
> Done. The patch is included with this email.

Thanks, pushed to `master`.
Closing,


        Stefan



--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]