From: "Zhu Zihao" <all_but_last@163.com>
To: emacs-devel@gnu.org
Subject: Struct defined by cl-defstruct with :noinline failed to set slot using setf
Date: Mon, 2 Sep 2019 13:03:31 +0800 (CST) [thread overview]
Message-ID: <1311fef9.a334.16cf05b4e08.Coremail.all_but_last@163.com> (raw)
[-- 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 --]
next reply other threads:[~2019-09-02 5:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-02 5:03 Zhu Zihao [this message]
2019-09-02 10:44 ` Struct defined by cl-defstruct with :noinline failed to set slot using setf Zhu Zihao
2019-09-02 12:57 ` Stefan Monnier
2019-09-02 13:10 ` Zhu Zihao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1311fef9.a334.16cf05b4e08.Coremail.all_but_last@163.com \
--to=all_but_last@163.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.