[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#27016: possible bug in `defsetf'

From: Stefan Monnier
Subject: bug#27016: possible bug in `defsetf'
Date: Thu, 13 Jul 2017 10:25:38 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

> Oh, I think I get it now.

Looks about right.  A few comments below.


> @@ -4577,6 +4582,7 @@ (byte-defop-compiler-1 defvar)
>  (byte-defop-compiler-1 defconst byte-compile-defvar)
>  (byte-defop-compiler-1 autoload)
>  (byte-defop-compiler-1 lambda byte-compile-lambda-form)
> +(byte-defop-compiler-1 function-put)
>  ;; If foo.el declares `toto' as obsolete, it is likely that foo.el will
>  ;; actually use `toto' in order for this obsolete variable to still work

I know it's not how it's done everywhere now, but I like to put the
byte-defop-compiler-1 next to the handler function.

> @@ -4725,6 +4731,18 @@ (put 'make-variable-buffer-local
>       'byte-hunk-handler 'byte-compile-form-make-variable-buffer-local)
>  (defun byte-compile-form-make-variable-buffer-local (form)
>    (byte-compile-keep-pending form 'byte-compile-normal-call))
> +
> +(defun byte-compile-function-put (form)
> +  (pcase form
> +    (`(,_ (,(or 'quote 'function) ,(and fun (guard (symbolp fun))))
> +          ',prop ,(or `#',value (and value (guard (functionp value)))))

The value doesn't have to be `functionp` (it is in the case of
gv-expander, but it depends on the property).

> +     (let ((fplist (assq fun byte-compile-plist-environment)))
> +       (if fplist
> +           (setcdr fplist (plist-put (cdr fplist) prop value))
> +         (push (cons fun (list prop value))
> +               byte-compile-plist-environment)))))

I'd just unconditionally use `push`:

         (push (cons fun `(,prop ,value . ,fplist))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]