GNU bug report logs - #66938
30.0.50 [PATCH]: Make EIEIO :accessor behave like :reader when reading a slot's value

Previous Next

Package: emacs;

Reported by: Brandon Irizarry <brandon.irizarry <at> gmail.com>

Date: Sat, 4 Nov 2023 22:04:01 UTC

Severity: normal

Tags: patch

Found in version 30.0.50

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

Bug is archived. No further changes may be made.

Full log


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

From: João Távora <joaotavora <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: brandon.irizarry <at> gmail.com, 66938 <at> debbugs.gnu.org,
 66938-done <at> debbugs.gnu.org
Subject: Re: bug#66938: 30.0.50 [PATCH]: Make EIEIO :accessor behave like
 :reader when reading a slot's value
Date: Wed, 29 Nov 2023 14:36:15 +0000
On Wed, Nov 29, 2023 at 2:01 PM Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:
>
> > Just wanted to say that while I think this is all very fine to
> > improve on EIEIO's inaccurate emulation of CLOS, this breaks
> > a lot of stuff, broke Eglot and Jsonrpc, immediately.
> >
> > This is mainly because EIEIO users like me got sloppy with
> > their slot definitions and don't put explicit :initforms
> > in them, instead relying on this quirk.
>
> FWIW, I don't like the `slot-boundp` business and much prefer the
> principle that if an application needs such a concept it should instead
> treat nil as the "unbound" marker.

Of course, this 'business' is so that you can perform these lazy
optimizations without a given user of a class ever noticing.  You
can even replace a slot by some other storage/generation mechanism
completely.  That's what all these (fairly expensive, granted) indirections
get you.  Also, as you probably guess, nil is a notoriously problematic
"unbound" marker.

> > Oh well, I'm fixing this now as part of bug#67480, but
> > we should definitely expect flak more or less proportional
> > to the use of EIEIO out there (and in here).
>
> Hmm...

I've seen two or three issues about this already.  But let's hope
for the best.  I support these fixes.

> > BTW another reason I get sloppy is that EIEIO doesn't allow
> > me to use a
> >
> > (some-slot :initform (error "required!") ...)
> >
> > like I do in CLOS.
>
> I think this works nowadays (the expression is not evaluated in the
> right context (it's evaluated in the empty context), but AFAICT it's
> evaluated at the right time):

No, I think there's something off.   In CLOS:

; SLY 1.0.43 (#<MREPL mrepl-1-1>)
CL-USER> (defclass foo () ((bar :initarg :bar :initform (error "BAR is
required!"))))
#<STANDARD-CLASS COMMON-LISP-USER::FOO>
CL-USER> (make-instance 'foo :bar 42)
#<FOO {100406B243}>
CL-USER> (make-instance 'foo)
; Debugger entered on #<SIMPLE-ERROR "BAR is required!" {1004301983}>

You can't do this in EIEIO:

*** Welcome to IELM ***  Type (describe-mode) or press C-h m for help.
ELISP> (defclass foo () ((bar :initarg :bar :initform (error "BAR is
required!"))))
*** Eval error ***  BAR is required!
ELISP>




This bug report was last modified 1 year and 173 days ago.

Previous Next


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