]> git.eshelyaron.com Git - emacs.git/commit
fcr.el: Add support for mutable slots
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 27 Dec 2021 05:52:05 +0000 (00:52 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 27 Dec 2021 05:52:05 +0000 (00:52 -0500)
commit6850f8983100ba512a5f1b028852e54bfe071607
treeb943e9cf3eaacf9f21c111fd6b620310ec7cc06b
parentf21b0935a0fd4c6186b1c1a5d95c2c792ff07a06
fcr.el: Add support for mutable slots

* lisp/emacs-lisp/fcr.el (fcr--defstruct-make-copiers): Adjust for the
case of mutable slots.  Optimize the mandatory arg case.
Don't mark the copiers as inlinable.
(fcr-defstruct): Allow `:type` and `:mutable` properties on slots.
(fcr--lambda): Add `mutables` arg.
(fcr-lambda): Pass it.
(fcr--copy): Add `mutlist` arg.
(fcr--get): Add `mutable` arg.
(fcr--set): New function.
(fcr--mut-getter-prototype, fcr--mut-setter-prototype):
New prototype functions.

* test/lisp/emacs-lisp/fcr-tests.el (fcr-test, fcr-tests):
Add test for copier with mandatory arg.
(fcr-test-mut, fcr-test--mutate): New test.

* lisp/emacs-lisp/nadvice.el (advice): Use separate copiers
for the two use-cases, to avoid relying on CL keywords, since they're
not optimized away via inlining any more.
(advice--make, advice--tweak): Adjust accordingly.
lisp/emacs-lisp/fcr.el
lisp/emacs-lisp/nadvice.el
test/lisp/emacs-lisp/fcr-tests.el