Subject: bug#51068: 28.0.50; eieio defclass regression in emacs 28

From: Lars Ingebrigtsen <[email-masked]>
Date: Mon, 12 Sep 2022 13:02:03 +0200

dalanicolai <[email-masked]> writes:

> Starting from emacs -Q, in Emacs 27 when I try to evaluate the following code:
>
> (require 'eieio)
>
> (defclass rectangle ()
>   (height width))
>
> different than in CLOS, Emacs errors with:
> '(wrong-type-argument listp height)'
>
> When I evaluate the same code in Emacs 28 then Emacs does not return an
> error.
>
> However, if I subsequently try to initialize the slots using:
>
> (let ((r (make-instance rectangle)))
>   (setf (slot-value r 'height) 2
>         (slot-value r 'width) 3))
>
> then Emacs 28 does return an error. If I replace the code to create the
> class with (adding the parentheses around the slots):
>
> (defclass rectangle ()
>   ((height) (width)))
>
> then the code above for initializing the slots works as expected (and similar behavior
> when using oref). Which means that also in Emacs 28 the parentheses are required.
> So Emacs 27 correctly errors when not using them, but Emacs 28 suggests that
> things are alright when omitting the parentheses which is incorrect and confusing.
>
> Then additionally, the requirement of the parentheses is, as far as I
> could find, not explicitly mentioned as a 'difference from CLOS' in the manual, which
> 'additionlly' is confusing.

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

This is still the case in Emacs 29.  Erroring out earlier (like Emacs
27) sounds like a good idea, and so is documenting this.

Perhaps Stefan has some comments; added to the CCs.