all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#68345: 29.1; cl-defstruct'ed struct errors out in the constructor compiler macro if a slot is called "quote"
@ 2024-01-09 12:32 Kisaragi Hiu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-01-09 14:19 ` Eli Zaretskii
  2024-01-09 14:59 ` Gerd Möllmann
  0 siblings, 2 replies; 6+ messages in thread
From: Kisaragi Hiu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-01-09 12:32 UTC (permalink / raw)
  To: 68345

* 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





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

* bug#68345: 29.1; cl-defstruct'ed struct errors out in the constructor compiler macro if a slot is called "quote"
  2024-01-09 12:32 bug#68345: 29.1; cl-defstruct'ed struct errors out in the constructor compiler macro if a slot is called "quote" Kisaragi Hiu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-01-09 14:19 ` Eli Zaretskii
  2024-01-09 14:59 ` Gerd Möllmann
  1 sibling, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2024-01-09 14:19 UTC (permalink / raw)
  To: Kisaragi Hiu, Stefan Monnier; +Cc: 68345

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





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

* bug#68345: 29.1; cl-defstruct'ed struct errors out in the constructor compiler macro if a slot is called "quote"
  2024-01-09 12:32 bug#68345: 29.1; cl-defstruct'ed struct errors out in the constructor compiler macro if a slot is called "quote" Kisaragi Hiu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-01-09 14:19 ` Eli Zaretskii
@ 2024-01-09 14:59 ` Gerd Möllmann
  2024-01-09 22:46   ` Kisaragi Hiu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 6+ messages in thread
From: Gerd Möllmann @ 2024-01-09 14:59 UTC (permalink / raw)
  To: 68345; +Cc: mail

Kisaragi Hiu via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@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.





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

* bug#68345: 29.1; cl-defstruct'ed struct errors out in the constructor compiler macro if a slot is called "quote"
  2024-01-09 14:59 ` Gerd Möllmann
@ 2024-01-09 22:46   ` Kisaragi Hiu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-01-10  5:33     ` Gerd Möllmann
  2024-01-10 12:55     ` Eli Zaretskii
  0 siblings, 2 replies; 6+ messages in thread
From: Kisaragi Hiu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-01-09 22:46 UTC (permalink / raw)
  To: Gerd Möllmann; +Cc: 68345

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.





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

* bug#68345: 29.1; cl-defstruct'ed struct errors out in the constructor compiler macro if a slot is called "quote"
  2024-01-09 22:46   ` Kisaragi Hiu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-01-10  5:33     ` Gerd Möllmann
  2024-01-10 12:55     ` Eli Zaretskii
  1 sibling, 0 replies; 6+ messages in thread
From: Gerd Möllmann @ 2024-01-10  5:33 UTC (permalink / raw)
  To: Kisaragi Hiu; +Cc: 68345

Kisaragi Hiu <mail@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.







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

* bug#68345: 29.1; cl-defstruct'ed struct errors out in the constructor compiler macro if a slot is called "quote"
  2024-01-09 22:46   ` Kisaragi Hiu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-01-10  5:33     ` Gerd Möllmann
@ 2024-01-10 12:55     ` Eli Zaretskii
  1 sibling, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2024-01-10 12:55 UTC (permalink / raw)
  To: Kisaragi Hiu; +Cc: gerd.moellmann, 68345-done

> Cc: 68345@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@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.





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

end of thread, other threads:[~2024-01-10 12:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-09 12:32 bug#68345: 29.1; cl-defstruct'ed struct errors out in the constructor compiler macro if a slot is called "quote" Kisaragi Hiu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-09 14:19 ` Eli Zaretskii
2024-01-09 14:59 ` Gerd Möllmann
2024-01-09 22:46   ` Kisaragi Hiu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-10  5:33     ` Gerd Möllmann
2024-01-10 12:55     ` Eli Zaretskii

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.