GNU bug report logs - #27016
possible bug in `defsetf'

Previous Next

Package: emacs;

Reported by: Rafael D Sorkin <rsorkin <at> perimeterinstitute.ca>

Date: Mon, 22 May 2017 06:40:01 UTC

Severity: minor

Tags: fixed, patch

Found in versions 24.4, 25.2

Fixed in version 26.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Noam Postavsky <npostavs <at> users.sourceforge.net>
Cc: 27016 <at> debbugs.gnu.org, Rafael D Sorkin <rsorkin <at> perimeterinstitute.ca>
Subject: bug#27016: possible bug in `defsetf'
Date: Thu, 25 May 2017 23:31:13 +0200
Noam Postavsky <npostavs <at> users.sourceforge.net> writes:

> Hmm, I thought it would cause the 'unless t' to happen in the
> macroexpansion phase as well, but I was wrong. Apparently 'eval-when'
> doesn't have this effect, only eval-when-compile or eval-and-compile
> will do the trick.

That also doesn't work.  Apart from the fact that you would have the
`defsetf' executed at compile time as side effect,

#+begin_src emacs-lisp
(macroexpand '(defsetf foo bar))
==>
'(lambda
   (do &rest args)
   (gv--defsetter 'foo
                  (lambda
                    (val &rest args)
                    `(,'bar ,@args ,val))
                  do args))
#+end_src

(i.e. a constant!).

When you compile a file with this content:

#+begin_src emacs-lisp
(eval-and-compile
  (unless nil
    (defsetf foo bar)))
#+end_src

you get an empty .elc.

Isn't that strange?


Michael.




This bug report was last modified 7 years and 290 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.