unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* 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

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