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

From: Stefan Monnier <[email-masked]>
Date: Tue, 11 Jul 2017 22:01:14 -0400

> I can see how that might work for function-get:
>
>     (defun function-get (f prop &optional autoload)
>       ...
>    +  (or
>    +   (if (eq prop 'gv-expander)
>    +       (alist-get f (alist-get :gv-expanders
>    +                               (bound-and-true-p
>    +                                byte-compile-macro-environment))))
>        (let ((val nil))
>          (while (and (symbolp f)
>                      (null (setq val (get f prop)))
>          ;; etc...

Why limit this to `gv-expander`?
Also, we should probably move the test within the subsequent `while`
loop, so that it interacts correctly with aliases.

> But how can I make function-put do the right thing for both a macro
> calling it and keep it's normal role?

I don't know what to do when a macro calls it (I can't think of any
reason we'd want to do that), but I know how to handle the case where
a macro outputs code that uses it: Add (byte-defop-compiler-1
function-put) as well as a byte-compile-function-put function.
See byte-compile-autoload and byte-compile-make-obsolete-variable
for examples.

        Stefan