]> git.eshelyaron.com Git - emacs.git/commit
oclosure.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)
commit55a8e924132c425d1f27493748567071d5cba308
treefdc778321776dd136e293266fa255b7b68a0b911
parentfe5457ff757ded7999610917f8f39d28b8908e6f
oclosure.el: Add support for mutable slots

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

* test/lisp/emacs-lisp/oclosure-tests.el (oclosure-test, oclosure-tests):
Add test for copier with mandatory arg.
(oclosure-test-mut, oclosure-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/nadvice.el
lisp/emacs-lisp/oclosure.el
test/lisp/emacs-lisp/oclosure-tests.el