GNU bug report logs -
#68345
29.1; cl-defstruct'ed struct errors out in the constructor compiler macro if a slot is called "quote"
Previous Next
Reported by: Kisaragi Hiu <mail <at> kisaragi-hiu.com>
Date: Tue, 9 Jan 2024 12:33:01 UTC
Severity: normal
Found in version 29.1
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 68345 in the body.
You can then email your comments to 68345 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#68345
; Package
emacs
.
(Tue, 09 Jan 2024 12:33:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Kisaragi Hiu <mail <at> kisaragi-hiu.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 09 Jan 2024 12:33:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
* The problem
If a struct is defined to have a slot called "quote", the constructor
will fail during the compiler macro phase.
(require 'cl-lib)
(cl-defstruct my-test quote)
(make-my-test :quote "'") ; error: (invalid-function "'")
(put 'make-my-test 'compiler-macro nil) ; disable the compiler macro
(make-my-test :quote "'") ; => #s(test "'")
I have tested Emacs 25.3, 26.3, 27.2, 28.2, and 29.1; this error is in
all these versions.
* Why this is a bug
This feels like a bug to me, because it's not clear that this would be
an unsupported use case, and because of the inconsistent behavior
between the constructor being inlined vs. without a compiler macro.
* Potential directions
This could be "fixed" by either digging into cl-defstruct and cl-lib
then fixing it properly, or by simply declaring in the documentation
that this is not supported. I wish for a proper fix, but the
documentation workaround also seems fine to me.
* Additional info
This is what the compiler macro for make-my-test expands into:
(cl-block make-my-test
(record
("'" my-test)
"'"))
In GNU Emacs 29.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38,
cairo version 1.17.8)
Windowing system distributor 'The X.Org Foundation', version 11.0.12101010
System Description: Arch Linux
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#68345
; Package
emacs
.
(Tue, 09 Jan 2024 14:21:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 68345 <at> debbugs.gnu.org (full text, mbox):
> Date: Tue, 9 Jan 2024 21:32:06 +0900
> From: Kisaragi Hiu via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>
> * The problem
>
> If a struct is defined to have a slot called "quote", the constructor
> will fail during the compiler macro phase.
>
> (require 'cl-lib)
> (cl-defstruct my-test quote)
> (make-my-test :quote "'") ; error: (invalid-function "'")
'quote' is a documented special form in Emacs, see the node "Quoting"
in the ELisp manual.
Adding Stefan to the discussion.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#68345
; Package
emacs
.
(Tue, 09 Jan 2024 15:00:02 GMT)
Full text and
rfc822 format available.
Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):
Kisaragi Hiu via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs <at> gnu.org> writes:
> * The problem
>
> If a struct is defined to have a slot called "quote", the constructor
> will fail during the compiler macro phase.
>
> (require 'cl-lib)
> (cl-defstruct my-test quote)
> (make-my-test :quote "'") ; error: (invalid-function "'")
>
> (put 'make-my-test 'compiler-macro nil) ; disable the compiler macro
> (make-my-test :quote "'") ; => #s(test "'")
>
> I have tested Emacs 25.3, 26.3, 27.2, 28.2, and 29.1; this error is in
> all these versions.
Could you please check with Emacs/master? Seems to work there.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#68345
; Package
emacs
.
(Tue, 09 Jan 2024 15:00:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#68345
; Package
emacs
.
(Tue, 09 Jan 2024 22:48:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 68345 <at> debbugs.gnu.org (full text, mbox):
On 2024/01/09 23:59, Gerd Möllmann wrote:
> Could you please check with Emacs/master? Seems to work there.
It works as I'd expect at master (commit
fccaeabc959f5403ce49744030bd2620352b59f8), without errors. I should've
checked master before filing this report - sorry about that.
I might run a bisect later to see how it was fixed, but this appears to
no longer be an issue.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#68345
; Package
emacs
.
(Wed, 10 Jan 2024 05:35:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 68345 <at> debbugs.gnu.org (full text, mbox):
Kisaragi Hiu <mail <at> kisaragi-hiu.com> writes:
> On 2024/01/09 23:59, Gerd Möllmann wrote:
>> Could you please check with Emacs/master? Seems to work there.
>
> It works as I'd expect at master (commit
> fccaeabc959f5403ce49744030bd2620352b59f8), without errors. I should've
> checked master before filing this report - sorry about that.
No problem, and thanks for testing!
>
> I might run a bisect later to see how it was fixed, but this appears
> to no longer be an issue.
Reply sent
to
Eli Zaretskii <eliz <at> gnu.org>
:
You have taken responsibility.
(Wed, 10 Jan 2024 13:48:05 GMT)
Full text and
rfc822 format available.
Notification sent
to
Kisaragi Hiu <mail <at> kisaragi-hiu.com>
:
bug acknowledged by developer.
(Wed, 10 Jan 2024 13:48:05 GMT)
Full text and
rfc822 format available.
Message #25 received at 68345-done <at> debbugs.gnu.org (full text, mbox):
> Cc: 68345 <at> debbugs.gnu.org
> Date: Wed, 10 Jan 2024 07:46:56 +0900
> From: Kisaragi Hiu via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>
> On 2024/01/09 23:59, Gerd Möllmann wrote:
> > Could you please check with Emacs/master? Seems to work there.
>
> It works as I'd expect at master (commit
> fccaeabc959f5403ce49744030bd2620352b59f8), without errors. I should've
> checked master before filing this report - sorry about that.
>
> I might run a bisect later to see how it was fixed, but this appears to
> no longer be an issue.
Thanks, closing.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 08 Feb 2024 12:24:11 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 192 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.