unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#66938: 30.0.50 [PATCH]: Make EIEIO :accessor behave like :reader when reading a slot's value
@ 2023-11-04 22:03 Brandon Irizarry
  2023-11-11 10:21 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Brandon Irizarry @ 2023-11-04 22:03 UTC (permalink / raw)
  To: 66938


[-- Attachment #1.1: Type: text/plain, Size: 1352 bytes --]

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 #1.2: Type: text/html, Size: 1697 bytes --]

[-- Attachment #2: 0001-Make-EIEIO-accessor-behave-like-reader-when-reading.patch --]
[-- Type: text/x-patch, Size: 2038 bytes --]

From 2d40d63d8738dc44b02ca61843fa61956958e84e Mon Sep 17 00:00:00 2001
From: Brandon <brandon.irizarry@gmail.com>
Date: Sat, 4 Nov 2023 17:11:32 -0400
Subject: [PATCH] Make EIEIO ':accessor' behave like ':reader' when reading

* lisp/emacs-lisp/eieio.el (defclass): Remove 'slot-boundp' check for
:accessor's getter

Clones of instances of subclasses of 'eieio-instance-inheritor' don't
delegate to their ':parent-instance' field when reading object fields
using ':accessor'.

Say I have this code:

(defclass foo (eieio-instance-inheritor)
  ((x :initarg :x
      :accessor ref-x
      :reader get-x)))

(setq obj1 (foo :x 4))   ; #s(foo eieio--unbound 4)
(setq obj2 (clone obj1)) ; #s(foo #s(foo eieio--unbound 4) eieio--unbound)

(ref-x obj1) ; 4, which is correct.
(ref-x obj2) ; nil. This is what we want to fix.
(get-x obj2) ; Gives us 4: access via the reader performs delegation.

My impression is that ':accessor' should behave as if ':reader' and
':writer' had been provided separately.

With this patch, '(ref-x obj2)' now uses the exact same method as
':reader', and so would give us 4, as desired.
---
 lisp/emacs-lisp/eieio.el | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el
index 39a5fd5b19c..8224606ec57 100644
--- a/lisp/emacs-lisp/eieio.el
+++ b/lisp/emacs-lisp/eieio.el
@@ -213,9 +213,8 @@ defclass
                    ,(internal--format-docstring-line
                      "Retrieve the slot `%S' from an object of class `%S'."
                      sname name)
-                   ;; FIXME: Why is this different from the :reader case?
-                   (if (slot-boundp this ',sname) (eieio-oref this ',sname)))
-                accessors)
+                   (slot-value this ',sname))
+                  accessors)
           (when (and eieio-backward-compatibility (eq alloc :class))
             ;; FIXME: How could I declare this *method* as obsolete.
             (push `(cl-defmethod ,acces ((this (subclass ,name)))
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* bug#66938: 30.0.50 [PATCH]: Make EIEIO :accessor behave like :reader when reading a slot's value
  2023-11-04 22:03 bug#66938: 30.0.50 [PATCH]: Make EIEIO :accessor behave like :reader when reading a slot's value Brandon Irizarry
@ 2023-11-11 10:21 ` Eli Zaretskii
  2023-11-25  9:28   ` Eli Zaretskii
  2023-11-25 14:56 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-11-29  2:01 ` bug#66938: 30.0.50; Commit 6c47931a1ad4de ("Make EIEIO ':accessor' behave like ':reader' when reading (bug#66938)") breaks Eglot Arsen Arsenović via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2023-11-11 10:21 UTC (permalink / raw)
  To: Brandon Irizarry, Stefan Monnier; +Cc: 66938

Stefan, any comments?

> From: Brandon Irizarry <brandon.irizarry@gmail.com>
> Date: Sat, 4 Nov 2023 18:03:06 -0400
> 
> 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
> 
> 
> From 2d40d63d8738dc44b02ca61843fa61956958e84e Mon Sep 17 00:00:00 2001
> From: Brandon <brandon.irizarry@gmail.com>
> Date: Sat, 4 Nov 2023 17:11:32 -0400
> Subject: [PATCH] Make EIEIO ':accessor' behave like ':reader' when reading
> 
> * lisp/emacs-lisp/eieio.el (defclass): Remove 'slot-boundp' check for
> :accessor's getter
> 
> Clones of instances of subclasses of 'eieio-instance-inheritor' don't
> delegate to their ':parent-instance' field when reading object fields
> using ':accessor'.
> 
> Say I have this code:
> 
> (defclass foo (eieio-instance-inheritor)
>   ((x :initarg :x
>       :accessor ref-x
>       :reader get-x)))
> 
> (setq obj1 (foo :x 4))   ; #s(foo eieio--unbound 4)
> (setq obj2 (clone obj1)) ; #s(foo #s(foo eieio--unbound 4) eieio--unbound)
> 
> (ref-x obj1) ; 4, which is correct.
> (ref-x obj2) ; nil. This is what we want to fix.
> (get-x obj2) ; Gives us 4: access via the reader performs delegation.
> 
> My impression is that ':accessor' should behave as if ':reader' and
> ':writer' had been provided separately.
> 
> With this patch, '(ref-x obj2)' now uses the exact same method as
> ':reader', and so would give us 4, as desired.
> ---
>  lisp/emacs-lisp/eieio.el | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el
> index 39a5fd5b19c..8224606ec57 100644
> --- a/lisp/emacs-lisp/eieio.el
> +++ b/lisp/emacs-lisp/eieio.el
> @@ -213,9 +213,8 @@ defclass
>                     ,(internal--format-docstring-line
>                       "Retrieve the slot `%S' from an object of class `%S'."
>                       sname name)
> -                   ;; FIXME: Why is this different from the :reader case?
> -                   (if (slot-boundp this ',sname) (eieio-oref this ',sname)))
> -                accessors)
> +                   (slot-value this ',sname))
> +                  accessors)
>            (when (and eieio-backward-compatibility (eq alloc :class))
>              ;; FIXME: How could I declare this *method* as obsolete.
>              (push `(cl-defmethod ,acces ((this (subclass ,name)))
> -- 
> 2.39.2
> 





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#66938: 30.0.50 [PATCH]: Make EIEIO :accessor behave like :reader when reading a slot's value
  2023-11-11 10:21 ` Eli Zaretskii
@ 2023-11-25  9:28   ` Eli Zaretskii
  0 siblings, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2023-11-25  9:28 UTC (permalink / raw)
  To: monnier; +Cc: brandon.irizarry, 66938

Ping!  Stefan, could you please look into this?

> Cc: 66938@debbugs.gnu.org
> Date: Sat, 11 Nov 2023 12:21:23 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> 
> Stefan, any comments?
> 
> > From: Brandon Irizarry <brandon.irizarry@gmail.com>
> > Date: Sat, 4 Nov 2023 18:03:06 -0400
> > 
> > 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
> > 
> > 
> > From 2d40d63d8738dc44b02ca61843fa61956958e84e Mon Sep 17 00:00:00 2001
> > From: Brandon <brandon.irizarry@gmail.com>
> > Date: Sat, 4 Nov 2023 17:11:32 -0400
> > Subject: [PATCH] Make EIEIO ':accessor' behave like ':reader' when reading
> > 
> > * lisp/emacs-lisp/eieio.el (defclass): Remove 'slot-boundp' check for
> > :accessor's getter
> > 
> > Clones of instances of subclasses of 'eieio-instance-inheritor' don't
> > delegate to their ':parent-instance' field when reading object fields
> > using ':accessor'.
> > 
> > Say I have this code:
> > 
> > (defclass foo (eieio-instance-inheritor)
> >   ((x :initarg :x
> >       :accessor ref-x
> >       :reader get-x)))
> > 
> > (setq obj1 (foo :x 4))   ; #s(foo eieio--unbound 4)
> > (setq obj2 (clone obj1)) ; #s(foo #s(foo eieio--unbound 4) eieio--unbound)
> > 
> > (ref-x obj1) ; 4, which is correct.
> > (ref-x obj2) ; nil. This is what we want to fix.
> > (get-x obj2) ; Gives us 4: access via the reader performs delegation.
> > 
> > My impression is that ':accessor' should behave as if ':reader' and
> > ':writer' had been provided separately.
> > 
> > With this patch, '(ref-x obj2)' now uses the exact same method as
> > ':reader', and so would give us 4, as desired.
> > ---
> >  lisp/emacs-lisp/eieio.el | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> > 
> > diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el
> > index 39a5fd5b19c..8224606ec57 100644
> > --- a/lisp/emacs-lisp/eieio.el
> > +++ b/lisp/emacs-lisp/eieio.el
> > @@ -213,9 +213,8 @@ defclass
> >                     ,(internal--format-docstring-line
> >                       "Retrieve the slot `%S' from an object of class `%S'."
> >                       sname name)
> > -                   ;; FIXME: Why is this different from the :reader case?
> > -                   (if (slot-boundp this ',sname) (eieio-oref this ',sname)))
> > -                accessors)
> > +                   (slot-value this ',sname))
> > +                  accessors)
> >            (when (and eieio-backward-compatibility (eq alloc :class))
> >              ;; FIXME: How could I declare this *method* as obsolete.
> >              (push `(cl-defmethod ,acces ((this (subclass ,name)))
> > -- 
> > 2.39.2
> > 
> 
> 
> 
> 





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#66938: 30.0.50 [PATCH]: Make EIEIO :accessor behave like :reader when reading a slot's value
  2023-11-04 22:03 bug#66938: 30.0.50 [PATCH]: Make EIEIO :accessor behave like :reader when reading a slot's value Brandon Irizarry
  2023-11-11 10:21 ` Eli Zaretskii
@ 2023-11-25 14:56 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-11-26  3:21   ` Brandon Irizarry
  2023-11-29  2:01 ` bug#66938: 30.0.50; Commit 6c47931a1ad4de ("Make EIEIO ':accessor' behave like ':reader' when reading (bug#66938)") breaks Eglot Arsen Arsenović via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2 siblings, 1 reply; 16+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-11-25 14:56 UTC (permalink / raw)
  To: Brandon Irizarry; +Cc: 66938

[ Sorry for the delay, and thanks Eli for re-pinging me.  ]

> 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.

The patch looks great and confirms my FIXME.

Could you turn the example in the commit message into a test in
test/lisp/emacs-lisp/eieio-tests/eieio-tests.el?


        Stefan






^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#66938: 30.0.50 [PATCH]: Make EIEIO :accessor behave like :reader when reading a slot's value
  2023-11-25 14:56 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-11-26  3:21   ` Brandon Irizarry
  2023-11-26 13:52     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 16+ messages in thread
From: Brandon Irizarry @ 2023-11-26  3:21 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 66938


[-- Attachment #1.1: Type: text/plain, Size: 915 bytes --]

Done. The patch is included with this email.

- Brandon

On Sat, Nov 25, 2023 at 9:57 AM Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

> [ Sorry for the delay, and thanks Eli for re-pinging me.  ]
>
> > 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.
>
> The patch looks great and confirms my FIXME.
>
> Could you turn the example in the commit message into a test in
> test/lisp/emacs-lisp/eieio-tests/eieio-tests.el?
>
>
>         Stefan
>
>

[-- Attachment #1.2: Type: text/html, Size: 1354 bytes --]

[-- Attachment #2: 0001-Bug-66938-add-example-used-in-patch-commit-message-t.patch --]
[-- Type: text/x-patch, Size: 1749 bytes --]

From 353dcb3333300a6f86f7bfa210d704876ec7b701 Mon Sep 17 00:00:00 2001
From: "Brandon C. Irizarry" <brandon.irizarry@gmail.com>
Date: Sat, 25 Nov 2023 22:09:00 -0500
Subject: [PATCH] Bug 66938: add example used in patch commit message to
 eieio-tests.el

This is in response to a request made by Stefan Monnier on
bug-gnu-emacs.
---
 .../emacs-lisp/eieio-tests/eieio-tests.el     | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
index c9993341f98..a0507afe833 100644
--- a/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
+++ b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
@@ -1046,6 +1046,27 @@ eieio-test-defstruct-slot-value
     (should (eq (eieio-test--struct-a x) 1))
     (should-error (setf (slot-value x 'c) 3) :type 'eieio-read-only)))
 
+(defclass foo-bug-66938 (eieio-instance-inheritor)
+  ((x :initarg :x
+      :accessor ref-x
+      :reader get-x))
+  "A class to test that delegation occurs under certain
+circumstances when using an accessor function, as it would when
+using the reader function.")
+
+(ert-deftest eieio-test-use-accessor-function-with-cloned-object ()
+  "The class FOO-BUG-66938 is a subclass of
+`eieio-instance-inheritor'. Therefore, given an instance OBJ1 of
+FOO-BUG-66938, and a clone (OBJ2), OBJ2 should delegate to OBJ1
+when accessing an unbound slot.
+
+In particular, its behavior should be identical to that of the
+reader function, when reading a slot."
+  (let* ((obj1 (foo-bug-66938 :x 4))
+         (obj2 (clone obj1)))
+    (should (eql (ref-x obj2) 4))
+    (should (eql (get-x obj2) (ref-x obj2)))))
+
 (provide 'eieio-tests)
 
 ;;; eieio-tests.el ends here
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* bug#66938: 30.0.50 [PATCH]: Make EIEIO :accessor behave like :reader when reading a slot's value
  2023-11-26  3:21   ` Brandon Irizarry
@ 2023-11-26 13:52     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-11-29  0:29       ` João Távora
  0 siblings, 1 reply; 16+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-11-26 13:52 UTC (permalink / raw)
  To: Brandon Irizarry; +Cc: 66938-done

> Done. The patch is included with this email.

Thanks, pushed to `master`.
Closing,


        Stefan






^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#66938: 30.0.50 [PATCH]: Make EIEIO :accessor behave like :reader when reading a slot's value
  2023-11-26 13:52     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-11-29  0:29       ` João Távora
  2023-11-29 14:01         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 16+ messages in thread
From: João Távora @ 2023-11-29  0:29 UTC (permalink / raw)
  To: Stefan Monnier, 66938, brandon.irizarry; +Cc: 66938-done

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.

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).

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.

The initform is meant to be evaluated during instantiation
(that's why it's a "form" ;-) )

João





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#66938: 30.0.50; Commit 6c47931a1ad4de ("Make EIEIO ':accessor' behave like ':reader' when reading (bug#66938)") breaks Eglot
  2023-11-04 22:03 bug#66938: 30.0.50 [PATCH]: Make EIEIO :accessor behave like :reader when reading a slot's value Brandon Irizarry
  2023-11-11 10:21 ` Eli Zaretskii
  2023-11-25 14:56 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-11-29  2:01 ` Arsen Arsenović via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-11-29 15:01   ` João Távora
  2 siblings, 1 reply; 16+ messages in thread
From: Arsen Arsenović via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-11-29  2:01 UTC (permalink / raw)
  To: 66938

[-- Attachment #1: Type: text/plain, Size: 12700 bytes --]

Hi,

The commit referenced above seems to break Eglot.  It generates the
following stack trace:

Debugger entered--Lisp error: (unbound-slot eglot-lsp-server "#<eglot-lsp-server eglot-lsp-server-156c8b8af842>" -events-buffer oref)
  signal(unbound-slot (eglot-lsp-server "#<eglot-lsp-server eglot-lsp-server-156c8b8af842>" -events-buffer oref))
... ; Removing extremely long frames
  eieio-barf-if-slot-unbound(eieio--unbound #<eglot-lsp-server eglot-lsp-server-156c8b8af842> -events-buffer oref)
  slot-value(#<eglot-lsp-server eglot-lsp-server-156c8b8af842> -events-buffer)
  #f(compiled-function (this) "Retrieve the slot `-events-buffer' from an object of class\n`jsonrpc-connection'." #<bytecode -0x1b11cbbb3991ccc5>)(#<eglot-lsp-server eglot-lsp-server-156c8b8af842>)
  apply(#f(compiled-function (this) "Retrieve the slot `-events-buffer' from an object of class\n`jsonrpc-connection'." #<bytecode -0x1b11cbbb3991ccc5>) #<eglot-lsp-server eglot-lsp-server-156c8b8af842> nil)
  jsonrpc--events-buffer(#<eglot-lsp-server eglot-lsp-server-156c8b8af842>)
  jsonrpc-events-buffer(#<eglot-lsp-server eglot-lsp-server-156c8b8af842>)
  jsonrpc--log-event(#<eglot-lsp-server eglot-lsp-server-156c8b8af842> (:message "Running language server: /usr/lib/llvm/17/bin/clangd"))
  jsonrpc--debug(#<eglot-lsp-server eglot-lsp-server-156c8b8af842> "Running language server: %s" "/usr/lib/llvm/17/bin/clangd")
  eglot--connect((c-mode c-ts-mode c++-mode c++-ts-mode objc-mode) (transient . "/tmp/") eglot-lsp-server ("/usr/lib/llvm/17/bin/clangd") ("c" "c" "c++" "c++" "objc"))
  eglot((c-mode c-ts-mode c++-mode c++-ts-mode objc-mode) (transient . "/tmp/") eglot-lsp-server ("/usr/lib/llvm/17/bin/clangd") ("c" "c" "c++" "c++" "objc") t)
  funcall-interactively(eglot (c-mode c-ts-mode c++-mode c++-ts-mode objc-mode) (transient . "/tmp/") eglot-lsp-server ("/usr/lib/llvm/17/bin/clangd") ("c" "c" "c++" "c++" "objc") t)
  command-execute(eglot record)
  execute-extended-command(nil "eglot" "eglot")
  funcall-interactively(execute-extended-command nil "eglot" "eglot")
  command-execute(execute-extended-command)

Reproduction steps:

- emacs -q
- C-x C-f foo.c RET
- M-x eglot RET

Apologies for my brevity and lack of analysis and/or a patch - it is
getting late.

Have a lovely night.

(note that the info below does not come from the emacs -q session I was
testing this in, but I can also reproduce this issue in this session)

In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.18.0) of 2023-11-28 built on localhost
Repository revision: 7a5c91a2831602c3cd961158cf0b6a876852d7ac
Repository branch: master
System Description: Gentoo Linux

Configured using:
 'configure --prefix=/usr --build=x86_64-pc-linux-gnu
 --host=x86_64-pc-linux-gnu --mandir=/usr/share/man
 --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc
 --localstatedir=/var/lib --datarootdir=/usr/share
 --disable-silent-rules --docdir=/usr/share/doc/emacs-30.0.9999
 --htmldir=/usr/share/doc/emacs-30.0.9999/html --libdir=/usr/lib64
 --program-suffix=-emacs-30-vcs --includedir=/usr/include/emacs-30-vcs
 --infodir=/usr/share/info/emacs-30-vcs --localstatedir=/var
 --enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp
 --without-compress-install --without-hesiod --without-pop
 --with-file-notification=inotify --with-pdumper --enable-acl
 --enable-xattr --with-dbus --with-modules --with-gameuser=:gamestat
 --with-libgmp --with-gpm --with-native-compilation=aot --with-json
 --without-kerberos --without-kerberos5 --with-lcms2 --with-xml2
 --with-mailutils --without-selinux --without-small-ja-dic
 --with-sqlite3 --with-gnutls --with-libsystemd --with-threads
 --with-tree-sitter --without-wide-int --with-sound=alsa --with-zlib
 --with-pgtk --without-x --without-ns --with-toolkit-scroll-bars
 --without-gconf --without-gsettings --with-harfbuzz --with-libotf
 --with-m17n-flt --with-xwidgets --with-gif --with-jpeg --with-png
 --with-rsvg --with-tiff --with-webp --without-imagemagick
 --with-dumping=pdumper 'CFLAGS=-freport-bug -O3 -ggdb3 -pipe
 -fdiagnostics-color=always -march=x86-64-v2 -flto' 'LDFLAGS=-Wl,-O1
 -Wl,--as-needed -O3 -Wl,-O3 -pipe -fdiagnostics-color=always
 -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,-z,pack-relative-relocs
 -Wl,--build-id -flto''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM HARFBUZZ JPEG JSON LCMS2
LIBOTF LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER
PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP XIM XWIDGETS GTK3 ZLIB

Important settings:
  value of $LC_TIME: en_GB.UTF-8
  value of $LANG: en_US.utf8
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  TeX-PDF-mode: t
  diff-hl-flydiff-mode: t
  global-jinx-mode: t
  savehist-mode: t
  save-place-mode: t
  desktop-save-mode: t
  global-hl-line-mode: t
  mu4e-modeline-mode: t
  corfu-popupinfo-mode: t
  global-corfu-mode: t
  corfu-mode: t
  marginalia-mode: t
  vertico-mouse-mode: t
  vertico-mode: t
  which-key-mode: t
  global-display-fill-column-indicator-mode: t
  display-fill-column-indicator-mode: t
  which-function-mode: t
  electric-pair-mode: t
  global-whitespace-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  column-number-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/usr/share/emacs/site-lisp/cmake-mode hides /usr/share/emacs/site-lisp/cmake/cmake-mode
/usr/share/emacs/site-lisp/desktop-entry-mode hides /usr/share/emacs/site-lisp/desktop-file-utils/desktop-entry-mode
/usr/share/emacs/site-lisp/ninja/ninja-mode hides /usr/share/emacs/site-lisp/ninja-kitware/ninja-mode
/usr/share/emacs/site-lisp/transient/transient hides /usr/share/emacs/30.0.50/lisp/transient

Features:
(shadow emacsbug view woman man org-clock dabbrev cape completion
image-file image-converter sort smiley gnus-cite mm-archive mail-extr qp
textsec uni-scripts idna-mapping ucs-normalize uni-confusable
textsec-check magit-bookmark git-rebase magit-extras
magit-sparse-checkout magit-gitignore magit-ediff ediff ediff-merg
ediff-mult ediff-wind ediff-diff ediff-help ediff-init ediff-util
magit-subtree magit-patch magit-submodule magit-blame magit-stash
magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone
magit-remote magit-commit magit-sequence magit-notes magit-worktree
magit-tag magit-merge magit-branch magit-reset magit-files magit-refs
magit-status magit package url-handlers magit-repos magit-apply
magit-wip magit-log magit-diff smerge-mode git-commit log-edit
magit-core magit-autorevert magit-margin magit-transient magit-process
with-editor comp comp-cstr server magit-mode transient magit-git
magit-base magit-section cursor-sensor face-remap shortdoc pulse
consult-xref disass misearch multi-isearch help-fns radix-tree cl-print
cus-start eglot external-completion jsonrpc xref ert debug backtrace
tramp-cache time-stamp consult pcmpl-unix em-unix em-term term ehelp
em-script em-prompt em-pred em-ls em-hist em-glob em-extpipe em-cmpl
em-dirs em-basic em-banner em-alias esh-mode esh-var eshell esh-cmd
esh-ext esh-opt esh-proc esh-io esh-arg esh-module esh-groups esh-util
vertico-directory add-log tar-mode arc-mode archive-mode font-latex
preview latex latex-flymake tex-ispell tex-style tex-mode tex-info tex
crm texmathp texinfo texinfo-loaddefs typescript-mode mhtml-mode
css-mode js c-ts-common conf-mode flycheck-pkgcheck meson-mode tcl
ruby-mode cperl-mode rng-xsd xsd-regexp rng-cmpct rng-nxml rng-valid
rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn
nxml-ns nxml-mode nxml-outln nxml-rap sgml-mode facemenu nxml-util
nxml-enc xmltok flymake-cc flymake compile warnings yaml-mode
autoconf-mode python project pcase dired-aux make-mode ld-script m4-mode
info cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align
cc-engine cc-vars cc-defs autorevert vc-git diff-hl-flydiff diff diff-hl
log-view pcvs-util vc-dir ewoc vc vc-dispatcher diff-mode jinx
ebuild-mode skeleton sh-script smie treesit executable
display-line-numbers oc-basic org-element org-persist org-id org-refile
avl-tree generator ol-eww eww url-queue mm-url ol-rmail ol-mhe ol-irc
ol-info ol-gnus nnselect ol-docview doc-view filenotify jka-compr
image-mode exif ol-bibtex bibtex ol-bbdb ol-w3m ol-doi org-link-doi
savehist saveplace tramp-sh tramp trampver tramp-integration files-x
tramp-message tramp-compat xdg shell tramp-loaddefs desktop frameset
cus-load mu4e mu4e-org mu4e-notification notifications mu4e-main
mu4e-view thingatpt gnus-art mm-uu mml2015 mm-view mml-smime smime
gnutls dig gnus-sum gnus-group gnus-undo gnus-start gnus-dbus dbus
comp-run comp-common gnus-cloud nnimap nnmail mail-source utf7 nnoo
parse-time iso8601 gnus-spec gnus-int gnus-range gnus-win gnus nnheader
range wid-edit mu4e-headers mu4e-compose mu4e-draft mu4e-actions
smtpmail mu4e-search mu4e-lists mu4e-bookmarks mu4e-mark mu4e-message
shr pixel-fill kinsoku url-file browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie generate-lisp-file
url-domsuf url-util flow-fill mule-util hl-line mu4e-contacts
mu4e-update mu4e-folders mu4e-context mu4e-query-items mu4e-server
mu4e-modeline mu4e-vars mu4e-helpers mu4e-config mu4e-window bookmark pp
ido message sendmail mailcap yank-media puny dired dired-loaddefs rfc822
mml mml-sec epa derived epg rfc6068 epg-config gnus-util
text-property-search mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils
gmm-utils mailheader mu4e-obsolete auth-source-pass url-parse url-vars
auth-source eieio eieio-core password-cache modus-vivendi-tinted-theme
modus-themes kind-icon svg-lib color svg dom xml corfu-popupinfo corfu
orderless marginalia vertico-mouse vertico compat flycheck json map dash
org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src
ob-comint org-pcomplete pcomplete comint ansi-osc ansi-color org-list
org-footnote org-faces org-entities time-date noutline outline
ob-emacs-lisp ob-core ob-eval org-cycle org-table ol rx org-fold
org-fold-core org-keys oc org-loaddefs find-func cal-menu calendar
cal-loaddefs org-version org-compat org-macs format-spec which-key
ace-window subr-x avy ring edmacro kmacro byte-opt
display-fill-column-indicator disp-table which-func imenu elec-pair
icons whitespace cl-macs gv cl-extra help-mode cl-seq use-package
use-package-ensure use-package-delight use-package-diminish
use-package-bind-key bind-key easy-mmode use-package-core cl-loaddefs
cl-lib bytecomp byte-compile site-gentoo preview-latex ess-autoloads
ess-generics tex-site rmc iso-transl tooltip cconv eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/pgtk-win pgtk-win term/common-win pgtk-dnd touch-screen tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads xwidget-internal dbusbind
inotify dynamic-setting font-render-setting cairo gtk pgtk lcms2
multi-tty move-toolbar make-network-process native-compile emacs)

Memory information:
((conses 16 1820713 3119067) (symbols 48 62485 159) (strings 32 319528 93051)
 (string-bytes 1 11499903) (vectors 16 193722) (vector-slots 8 3684047 2741445)
 (floats 8 936 13963) (intervals 56 100361 18396) (buffers 992 330))
-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#66938: 30.0.50 [PATCH]: Make EIEIO :accessor behave like :reader when reading a slot's value
  2023-11-29  0:29       ` João Távora
@ 2023-11-29 14:01         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-11-29 14:36           ` João Távora
  0 siblings, 1 reply; 16+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-11-29 14:01 UTC (permalink / raw)
  To: João Távora; +Cc: brandon.irizarry, 66938, 66938-done

> 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.

> 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...

> 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):

    (cl-defmethod initialize-instance ((this eieio-default-superclass)
    				   &optional args)
      [...]
          (let* ((slot (aref slots i))
                 (slot-name (eieio-slot-descriptor-name slot))
                 (initform (cl--slot-descriptor-initform slot)))
            [...]
              (eieio-oset this slot-name (eval initform t))))))
       [...]


-- Stefan






^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#66938: 30.0.50 [PATCH]: Make EIEIO :accessor behave like :reader when reading a slot's value
  2023-11-29 14:01         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-11-29 14:36           ` João Távora
  2023-11-29 15:46             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 16+ messages in thread
From: João Távora @ 2023-11-29 14:36 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: brandon.irizarry, 66938, 66938-done

On Wed, Nov 29, 2023 at 2:01 PM Stefan Monnier <monnier@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>





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#66938: 30.0.50; Commit 6c47931a1ad4de ("Make EIEIO ':accessor' behave like ':reader' when reading (bug#66938)") breaks Eglot
  2023-11-29  2:01 ` bug#66938: 30.0.50; Commit 6c47931a1ad4de ("Make EIEIO ':accessor' behave like ':reader' when reading (bug#66938)") breaks Eglot Arsen Arsenović via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-11-29 15:01   ` João Távora
  2023-11-29 15:25     ` Arsen Arsenović via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 16+ messages in thread
From: João Távora @ 2023-11-29 15:01 UTC (permalink / raw)
  To: Arsen Arsenović; +Cc: 66938

merge 66938 67480
thanks

Please see bug#67480.  This has been fixed in master already, I think.
João


On Wed, Nov 29, 2023 at 2:05 AM Arsen Arsenović via Bug reports for
GNU Emacs, the Swiss army knife of text editors
<bug-gnu-emacs@gnu.org> wrote:
>
> Hi,
>
> The commit referenced above seems to break Eglot.  It generates the
> following stack trace:
>
> Debugger entered--Lisp error: (unbound-slot eglot-lsp-server "#<eglot-lsp-server eglot-lsp-server-156c8b8af842>" -events-buffer oref)
>   signal(unbound-slot (eglot-lsp-server "#<eglot-lsp-server eglot-lsp-server-156c8b8af842>" -events-buffer oref))
> ... ; Removing extremely long frames
>   eieio-barf-if-slot-unbound(eieio--unbound #<eglot-lsp-server eglot-lsp-server-156c8b8af842> -events-buffer oref)
>   slot-value(#<eglot-lsp-server eglot-lsp-server-156c8b8af842> -events-buffer)
>   #f(compiled-function (this) "Retrieve the slot `-events-buffer' from an object of class\n`jsonrpc-connection'." #<bytecode -0x1b11cbbb3991ccc5>)(#<eglot-lsp-server eglot-lsp-server-156c8b8af842>)
>   apply(#f(compiled-function (this) "Retrieve the slot `-events-buffer' from an object of class\n`jsonrpc-connection'." #<bytecode -0x1b11cbbb3991ccc5>) #<eglot-lsp-server eglot-lsp-server-156c8b8af842> nil)
>   jsonrpc--events-buffer(#<eglot-lsp-server eglot-lsp-server-156c8b8af842>)
>   jsonrpc-events-buffer(#<eglot-lsp-server eglot-lsp-server-156c8b8af842>)
>   jsonrpc--log-event(#<eglot-lsp-server eglot-lsp-server-156c8b8af842> (:message "Running language server: /usr/lib/llvm/17/bin/clangd"))
>   jsonrpc--debug(#<eglot-lsp-server eglot-lsp-server-156c8b8af842> "Running language server: %s" "/usr/lib/llvm/17/bin/clangd")
>   eglot--connect((c-mode c-ts-mode c++-mode c++-ts-mode objc-mode) (transient . "/tmp/") eglot-lsp-server ("/usr/lib/llvm/17/bin/clangd") ("c" "c" "c++" "c++" "objc"))
>   eglot((c-mode c-ts-mode c++-mode c++-ts-mode objc-mode) (transient . "/tmp/") eglot-lsp-server ("/usr/lib/llvm/17/bin/clangd") ("c" "c" "c++" "c++" "objc") t)
>   funcall-interactively(eglot (c-mode c-ts-mode c++-mode c++-ts-mode objc-mode) (transient . "/tmp/") eglot-lsp-server ("/usr/lib/llvm/17/bin/clangd") ("c" "c" "c++" "c++" "objc") t)
>   command-execute(eglot record)
>   execute-extended-command(nil "eglot" "eglot")
>   funcall-interactively(execute-extended-command nil "eglot" "eglot")
>   command-execute(execute-extended-command)
>
> Reproduction steps:
>
> - emacs -q
> - C-x C-f foo.c RET
> - M-x eglot RET
>
> Apologies for my brevity and lack of analysis and/or a patch - it is
> getting late.
>
> Have a lovely night.
>
> (note that the info below does not come from the emacs -q session I was
> testing this in, but I can also reproduce this issue in this session)
>
> In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
>  3.24.38, cairo version 1.18.0) of 2023-11-28 built on localhost
> Repository revision: 7a5c91a2831602c3cd961158cf0b6a876852d7ac
> Repository branch: master
> System Description: Gentoo Linux
>
> Configured using:
>  'configure --prefix=/usr --build=x86_64-pc-linux-gnu
>  --host=x86_64-pc-linux-gnu --mandir=/usr/share/man
>  --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc
>  --localstatedir=/var/lib --datarootdir=/usr/share
>  --disable-silent-rules --docdir=/usr/share/doc/emacs-30.0.9999
>  --htmldir=/usr/share/doc/emacs-30.0.9999/html --libdir=/usr/lib64
>  --program-suffix=-emacs-30-vcs --includedir=/usr/include/emacs-30-vcs
>  --infodir=/usr/share/info/emacs-30-vcs --localstatedir=/var
>  --enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp
>  --without-compress-install --without-hesiod --without-pop
>  --with-file-notification=inotify --with-pdumper --enable-acl
>  --enable-xattr --with-dbus --with-modules --with-gameuser=:gamestat
>  --with-libgmp --with-gpm --with-native-compilation=aot --with-json
>  --without-kerberos --without-kerberos5 --with-lcms2 --with-xml2
>  --with-mailutils --without-selinux --without-small-ja-dic
>  --with-sqlite3 --with-gnutls --with-libsystemd --with-threads
>  --with-tree-sitter --without-wide-int --with-sound=alsa --with-zlib
>  --with-pgtk --without-x --without-ns --with-toolkit-scroll-bars
>  --without-gconf --without-gsettings --with-harfbuzz --with-libotf
>  --with-m17n-flt --with-xwidgets --with-gif --with-jpeg --with-png
>  --with-rsvg --with-tiff --with-webp --without-imagemagick
>  --with-dumping=pdumper 'CFLAGS=-freport-bug -O3 -ggdb3 -pipe
>  -fdiagnostics-color=always -march=x86-64-v2 -flto' 'LDFLAGS=-Wl,-O1
>  -Wl,--as-needed -O3 -Wl,-O3 -pipe -fdiagnostics-color=always
>  -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,-z,pack-relative-relocs
>  -Wl,--build-id -flto''
>
> Configured features:
> ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM HARFBUZZ JPEG JSON LCMS2
> LIBOTF LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER
> PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
> TREE_SITTER WEBP XIM XWIDGETS GTK3 ZLIB
>
> Important settings:
>   value of $LC_TIME: en_GB.UTF-8
>   value of $LANG: en_US.utf8
>   locale-coding-system: utf-8-unix
>
> Major mode: Fundamental
>
> Minor modes in effect:
>   global-git-commit-mode: t
>   magit-auto-revert-mode: t
>   TeX-PDF-mode: t
>   diff-hl-flydiff-mode: t
>   global-jinx-mode: t
>   savehist-mode: t
>   save-place-mode: t
>   desktop-save-mode: t
>   global-hl-line-mode: t
>   mu4e-modeline-mode: t
>   corfu-popupinfo-mode: t
>   global-corfu-mode: t
>   corfu-mode: t
>   marginalia-mode: t
>   vertico-mouse-mode: t
>   vertico-mode: t
>   which-key-mode: t
>   global-display-fill-column-indicator-mode: t
>   display-fill-column-indicator-mode: t
>   which-function-mode: t
>   electric-pair-mode: t
>   global-whitespace-mode: t
>   override-global-mode: t
>   tooltip-mode: t
>   global-eldoc-mode: t
>   show-paren-mode: t
>   electric-indent-mode: t
>   mouse-wheel-mode: t
>   tab-bar-mode: t
>   menu-bar-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   font-lock-mode: t
>   blink-cursor-mode: t
>   minibuffer-regexp-mode: t
>   column-number-mode: t
>   line-number-mode: t
>   indent-tabs-mode: t
>   transient-mark-mode: t
>   auto-composition-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
>
> Load-path shadows:
> /usr/share/emacs/site-lisp/cmake-mode hides /usr/share/emacs/site-lisp/cmake/cmake-mode
> /usr/share/emacs/site-lisp/desktop-entry-mode hides /usr/share/emacs/site-lisp/desktop-file-utils/desktop-entry-mode
> /usr/share/emacs/site-lisp/ninja/ninja-mode hides /usr/share/emacs/site-lisp/ninja-kitware/ninja-mode
> /usr/share/emacs/site-lisp/transient/transient hides /usr/share/emacs/30.0.50/lisp/transient
>
> Features:
> (shadow emacsbug view woman man org-clock dabbrev cape completion
> image-file image-converter sort smiley gnus-cite mm-archive mail-extr qp
> textsec uni-scripts idna-mapping ucs-normalize uni-confusable
> textsec-check magit-bookmark git-rebase magit-extras
> magit-sparse-checkout magit-gitignore magit-ediff ediff ediff-merg
> ediff-mult ediff-wind ediff-diff ediff-help ediff-init ediff-util
> magit-subtree magit-patch magit-submodule magit-blame magit-stash
> magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone
> magit-remote magit-commit magit-sequence magit-notes magit-worktree
> magit-tag magit-merge magit-branch magit-reset magit-files magit-refs
> magit-status magit package url-handlers magit-repos magit-apply
> magit-wip magit-log magit-diff smerge-mode git-commit log-edit
> magit-core magit-autorevert magit-margin magit-transient magit-process
> with-editor comp comp-cstr server magit-mode transient magit-git
> magit-base magit-section cursor-sensor face-remap shortdoc pulse
> consult-xref disass misearch multi-isearch help-fns radix-tree cl-print
> cus-start eglot external-completion jsonrpc xref ert debug backtrace
> tramp-cache time-stamp consult pcmpl-unix em-unix em-term term ehelp
> em-script em-prompt em-pred em-ls em-hist em-glob em-extpipe em-cmpl
> em-dirs em-basic em-banner em-alias esh-mode esh-var eshell esh-cmd
> esh-ext esh-opt esh-proc esh-io esh-arg esh-module esh-groups esh-util
> vertico-directory add-log tar-mode arc-mode archive-mode font-latex
> preview latex latex-flymake tex-ispell tex-style tex-mode tex-info tex
> crm texmathp texinfo texinfo-loaddefs typescript-mode mhtml-mode
> css-mode js c-ts-common conf-mode flycheck-pkgcheck meson-mode tcl
> ruby-mode cperl-mode rng-xsd xsd-regexp rng-cmpct rng-nxml rng-valid
> rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn
> nxml-ns nxml-mode nxml-outln nxml-rap sgml-mode facemenu nxml-util
> nxml-enc xmltok flymake-cc flymake compile warnings yaml-mode
> autoconf-mode python project pcase dired-aux make-mode ld-script m4-mode
> info cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align
> cc-engine cc-vars cc-defs autorevert vc-git diff-hl-flydiff diff diff-hl
> log-view pcvs-util vc-dir ewoc vc vc-dispatcher diff-mode jinx
> ebuild-mode skeleton sh-script smie treesit executable
> display-line-numbers oc-basic org-element org-persist org-id org-refile
> avl-tree generator ol-eww eww url-queue mm-url ol-rmail ol-mhe ol-irc
> ol-info ol-gnus nnselect ol-docview doc-view filenotify jka-compr
> image-mode exif ol-bibtex bibtex ol-bbdb ol-w3m ol-doi org-link-doi
> savehist saveplace tramp-sh tramp trampver tramp-integration files-x
> tramp-message tramp-compat xdg shell tramp-loaddefs desktop frameset
> cus-load mu4e mu4e-org mu4e-notification notifications mu4e-main
> mu4e-view thingatpt gnus-art mm-uu mml2015 mm-view mml-smime smime
> gnutls dig gnus-sum gnus-group gnus-undo gnus-start gnus-dbus dbus
> comp-run comp-common gnus-cloud nnimap nnmail mail-source utf7 nnoo
> parse-time iso8601 gnus-spec gnus-int gnus-range gnus-win gnus nnheader
> range wid-edit mu4e-headers mu4e-compose mu4e-draft mu4e-actions
> smtpmail mu4e-search mu4e-lists mu4e-bookmarks mu4e-mark mu4e-message
> shr pixel-fill kinsoku url-file browse-url url url-proxy url-privacy
> url-expand url-methods url-history url-cookie generate-lisp-file
> url-domsuf url-util flow-fill mule-util hl-line mu4e-contacts
> mu4e-update mu4e-folders mu4e-context mu4e-query-items mu4e-server
> mu4e-modeline mu4e-vars mu4e-helpers mu4e-config mu4e-window bookmark pp
> ido message sendmail mailcap yank-media puny dired dired-loaddefs rfc822
> mml mml-sec epa derived epg rfc6068 epg-config gnus-util
> text-property-search mm-decode mm-bodies mm-encode mail-parse rfc2231
> rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils
> gmm-utils mailheader mu4e-obsolete auth-source-pass url-parse url-vars
> auth-source eieio eieio-core password-cache modus-vivendi-tinted-theme
> modus-themes kind-icon svg-lib color svg dom xml corfu-popupinfo corfu
> orderless marginalia vertico-mouse vertico compat flycheck json map dash
> org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src
> ob-comint org-pcomplete pcomplete comint ansi-osc ansi-color org-list
> org-footnote org-faces org-entities time-date noutline outline
> ob-emacs-lisp ob-core ob-eval org-cycle org-table ol rx org-fold
> org-fold-core org-keys oc org-loaddefs find-func cal-menu calendar
> cal-loaddefs org-version org-compat org-macs format-spec which-key
> ace-window subr-x avy ring edmacro kmacro byte-opt
> display-fill-column-indicator disp-table which-func imenu elec-pair
> icons whitespace cl-macs gv cl-extra help-mode cl-seq use-package
> use-package-ensure use-package-delight use-package-diminish
> use-package-bind-key bind-key easy-mmode use-package-core cl-loaddefs
> cl-lib bytecomp byte-compile site-gentoo preview-latex ess-autoloads
> ess-generics tex-site rmc iso-transl tooltip cconv eldoc paren electric
> uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
> term/pgtk-win pgtk-win term/common-win pgtk-dnd touch-screen tool-bar
> dnd fontset image regexp-opt fringe tabulated-list replace newcomment
> text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
> isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax
> font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
> indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
> tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
> romanian slovak czech european ethiopic indian cyrillic chinese
> composite emoji-zwj charscript charprop case-table epa-hook
> jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
> theme-loaddefs faces cus-face macroexp files window text-properties
> overlay sha1 md5 base64 format env code-pages mule custom widget keymap
> hashtable-print-readable backquote threads xwidget-internal dbusbind
> inotify dynamic-setting font-render-setting cairo gtk pgtk lcms2
> multi-tty move-toolbar make-network-process native-compile emacs)
>
> Memory information:
> ((conses 16 1820713 3119067) (symbols 48 62485 159) (strings 32 319528 93051)
>  (string-bytes 1 11499903) (vectors 16 193722) (vector-slots 8 3684047 2741445)
>  (floats 8 936 13963) (intervals 56 100361 18396) (buffers 992 330))
> --
> Arsen Arsenović



--
João Távora





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#66938: 30.0.50; Commit 6c47931a1ad4de ("Make EIEIO ':accessor' behave like ':reader' when reading (bug#66938)") breaks Eglot
  2023-11-29 15:01   ` João Távora
@ 2023-11-29 15:25     ` Arsen Arsenović via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-11-29 15:43       ` João Távora
  0 siblings, 1 reply; 16+ messages in thread
From: Arsen Arsenović via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-11-29 15:25 UTC (permalink / raw)
  To: João Távora; +Cc: 66938

[-- Attachment #1: Type: text/plain, Size: 357 bytes --]


João Távora <joaotavora@gmail.com> writes:

> merge 66938 67480
> thanks
>
> Please see bug#67480.  This has been fixed in master already, I think.
> João

Indeed, apologies.  There was a race between me finding the commit that
broke jsonrpc.el and you fixing it :-)

Thanks for the prompt fix.

Have a lovely day.
-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#66938: 30.0.50; Commit 6c47931a1ad4de ("Make EIEIO ':accessor' behave like ':reader' when reading (bug#66938)") breaks Eglot
  2023-11-29 15:25     ` Arsen Arsenović via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-11-29 15:43       ` João Távora
  0 siblings, 0 replies; 16+ messages in thread
From: João Távora @ 2023-11-29 15:43 UTC (permalink / raw)
  To: Arsen Arsenović; +Cc: 66938

On Wed, Nov 29, 2023 at 3:26 PM Arsen Arsenović <arsen@aarsen.me> wrote:

> Indeed, apologies.  There was a race between me finding the commit that
> broke jsonrpc.el and you fixing it :-)
>
> Thanks for the prompt fix.

You're welcome, and no need to apologize!

João





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#66938: 30.0.50 [PATCH]: Make EIEIO :accessor behave like :reader when reading a slot's value
  2023-11-29 14:36           ` João Távora
@ 2023-11-29 15:46             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-11-29 16:09               ` João Távora
  0 siblings, 1 reply; 16+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-11-29 15:46 UTC (permalink / raw)
  To: João Távora; +Cc: brandon.irizarry, 66938, 66938-done

>> 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:
[...]
> *** 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>

Duh!  Still victim from the original EIEIO design where the `:initform`s
were executed at `defclass` time and then stored in a kind of
"prototype" object (presumably to speed up the creation of objects).

I pushed the patch below to fix this problem.  I can't believe this has
lingered since my Emacs-25 "rework" where I went through the trouble to
better align the semantics with that of CLOS.


        Stefan


diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el
index a394156c93a..37c5ebdb6da 100644
--- a/lisp/emacs-lisp/eieio-core.el
+++ b/lisp/emacs-lisp/eieio-core.el
@@ -951,7 +951,10 @@ eieio-set-defaults
   (let ((slots (eieio--class-slots (eieio--object-class obj))))
     (dotimes (i (length slots))
       (let* ((name (cl--slot-descriptor-name (aref slots i)))
-             (df (eieio-oref-default obj name)))
+             ;; If the `:initform` signals an error, just skip it,
+             ;; since the error is intended to be signal'ed from
+             ;; `initialize-instance` rather than at the time of `defclass`.
+             (df (ignore-errors (eieio-oref-default obj name))))
         (if (or df set-all)
             (eieio-oset obj name df))))))
 






^ permalink raw reply related	[flat|nested] 16+ messages in thread

* bug#66938: 30.0.50 [PATCH]: Make EIEIO :accessor behave like :reader when reading a slot's value
  2023-11-29 15:46             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-11-29 16:09               ` João Távora
  2023-11-29 16:36                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 16+ messages in thread
From: João Távora @ 2023-11-29 16:09 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: brandon.irizarry, 66938, 66938-done

On Wed, Nov 29, 2023 at 3:47 PM Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el
> index a394156c93a..37c5ebdb6da 100644
> --- a/lisp/emacs-lisp/eieio-core.el
> +++ b/lisp/emacs-lisp/eieio-core.el
> @@ -951,7 +951,10 @@ eieio-set-defaults
>    (let ((slots (eieio--class-slots (eieio--object-class obj))))
>      (dotimes (i (length slots))
>        (let* ((name (cl--slot-descriptor-name (aref slots i)))
> -             (df (eieio-oref-default obj name)))
> +             ;; If the `:initform` signals an error, just skip it,
> +             ;; since the error is intended to be signal'ed from
> +             ;; `initialize-instance` rather than at the time of `defclass`.
> +             (df (ignore-errors (eieio-oref-default obj name))))
>          (if (or df set-all)
>              (eieio-oset obj name df))))))
>

So the initform  is evaluated twice now, once with errors
shooshed?  What about side effects? (I know, a terrible idea,
but still...) Can't we just not eval it at defclass time?

João





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#66938: 30.0.50 [PATCH]: Make EIEIO :accessor behave like :reader when reading a slot's value
  2023-11-29 16:09               ` João Távora
@ 2023-11-29 16:36                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 16+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-11-29 16:36 UTC (permalink / raw)
  To: João Távora; +Cc: brandon.irizarry, 66938, 66938-done

> So the initform  is evaluated twice now, once with errors shooshed?

An object is created during `declass`, so it's called N+1 times.

> What about side effects? (I know, a terrible idea,
> but still...) Can't we just not eval it at defclass time?

I'm with you here, but I don't have the time to look at what would have
to be changed.


        Stefan






^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-11-29 16:36 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-04 22:03 bug#66938: 30.0.50 [PATCH]: Make EIEIO :accessor behave like :reader when reading a slot's value Brandon Irizarry
2023-11-11 10:21 ` Eli Zaretskii
2023-11-25  9:28   ` Eli Zaretskii
2023-11-25 14:56 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-26  3:21   ` Brandon Irizarry
2023-11-26 13:52     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-29  0:29       ` João Távora
2023-11-29 14:01         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-29 14:36           ` João Távora
2023-11-29 15:46             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-29 16:09               ` João Távora
2023-11-29 16:36                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-29  2:01 ` bug#66938: 30.0.50; Commit 6c47931a1ad4de ("Make EIEIO ':accessor' behave like ':reader' when reading (bug#66938)") breaks Eglot Arsen Arsenović via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-29 15:01   ` João Távora
2023-11-29 15:25     ` Arsen Arsenović via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-29 15:43       ` João Távora

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).