* Struct defined by cl-defstruct with :noinline failed to set slot using setf
@ 2019-09-02 5:03 Zhu Zihao
2019-09-02 10:44 ` Zhu Zihao
2019-09-02 12:57 ` Stefan Monnier
0 siblings, 2 replies; 4+ messages in thread
From: Zhu Zihao @ 2019-09-02 5:03 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 519 bytes --]
Consider following code at dd162a3f226
(cl-defstruct (a (:noinline t)) b c)
(let ((a (make-a :b 1 :c 2)))
(setf (a-b a) 1))
Get an error "Symbol’s function definition is void: \(setf\ a-b\)".
IMO, the problem is when :noinline was given, cl-defstruct will use defun
instead of cl-defsubst to create getter, which can't be handled by "setf"'s form
expansion automatically. If we want to allow user to modify slots of a struct
defined with :noinline argument, we should define the setters manually.
--
Zihao
[-- Attachment #2: Type: text/html, Size: 761 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Struct defined by cl-defstruct with :noinline failed to set slot using setf
2019-09-02 5:03 Struct defined by cl-defstruct with :noinline failed to set slot using setf Zhu Zihao
@ 2019-09-02 10:44 ` Zhu Zihao
2019-09-02 12:57 ` Stefan Monnier
1 sibling, 0 replies; 4+ messages in thread
From: Zhu Zihao @ 2019-09-02 10:44 UTC (permalink / raw)
To: emacs-devel; +Cc: Stefan Monnier
Can you check commit 144b2243b7cee4adbc3217d871c575921f95af54 for setf issue I
metioned above? I just see you are the author of that commit.
--
Zihao
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Struct defined by cl-defstruct with :noinline failed to set slot using setf
2019-09-02 5:03 Struct defined by cl-defstruct with :noinline failed to set slot using setf Zhu Zihao
2019-09-02 10:44 ` Zhu Zihao
@ 2019-09-02 12:57 ` Stefan Monnier
2019-09-02 13:10 ` Zhu Zihao
1 sibling, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2019-09-02 12:57 UTC (permalink / raw)
To: Zhu Zihao; +Cc: emacs-devel
> (let ((a (make-a :b 1 :c 2)))
> (setf (a-b a) 1))
> Get an error "Symbol’s function definition is void: \(setf\ a-b\)".
Indeed! Thanks for the report.
Could you `M-x report-emacs-bug` for it?
I have no time to look into fixing it right now, so it would be good to
have a bug-number to keep track of it.
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Struct defined by cl-defstruct with :noinline failed to set slot using setf
2019-09-02 12:57 ` Stefan Monnier
@ 2019-09-02 13:10 ` Zhu Zihao
0 siblings, 0 replies; 4+ messages in thread
From: Zhu Zihao @ 2019-09-02 13:10 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Zhu Zihao, emacs-devel
On Mon, 02 Sep 2019 20:57:20 +0800,
Stefan Monnier wrote:
>
> > (let ((a (make-a :b 1 :c 2)))
> > (setf (a-b a) 1))
> > Get an error "Symbol’s function definition is void: \(setf\ a-b\)".
>
> Indeed! Thanks for the report.
>
> Could you `M-x report-emacs-bug` for it?
> I have no time to look into fixing it right now, so it would be good to
> have a bug-number to keep track of it.
>
>
> Stefan
>
>
Done, thanks for your reply.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-09-02 13:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-02 5:03 Struct defined by cl-defstruct with :noinline failed to set slot using setf Zhu Zihao
2019-09-02 10:44 ` Zhu Zihao
2019-09-02 12:57 ` Stefan Monnier
2019-09-02 13:10 ` Zhu Zihao
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).