* bug#12813: gv-define-simple-setter can evaluate VAL more than once
@ 2012-11-06 7:47 Glenn Morris
2012-11-07 3:39 ` Stefan Monnier
0 siblings, 1 reply; 2+ messages in thread
From: Glenn Morris @ 2012-11-06 7:47 UTC (permalink / raw)
To: 12813
Package: emacs
Version: 24.2.50
I don't know if you will consider this a bug.
gv-define-simple-setter with FIX-RETURN non-nil evaluates VAL twice.
This may lead to unintended behaviour.
Artificial example in `emacs -Q':
(defun foo (x)
(car x))
(defun foo-set (x y)
(setcar x y))
(gv-define-simple-setter foo foo-set t)
(setq bar '(1 2 3))
(setq i 0)
(setf (foo bar) (setq i (1+ i))) ; -> 1
bar ; -> (2 2 3) rather than (1 2 3)
defsetf in 24.2 was documented to not have this issue
(info "(cl)Customizing Setf")
[...]
(let ((temp VALUE))
(UPDATE-FN ARG1 ARG2 ARG3 temp)
temp)
So at the very least this will be relevant if http://debbugs.gnu.org/12812
gets the "obvious" fix.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-11-07 3:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-06 7:47 bug#12813: gv-define-simple-setter can evaluate VAL more than once Glenn Morris
2012-11-07 3:39 ` Stefan Monnier
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).