Subject: Re: bug#27016: possible bug in `defsetf'

From: Michael Heerdegen <[email-masked]>
Date: Thu, 25 May 2017 23:31:13 +0200

Noam Postavsky <[email-masked]> 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.