[Top][All Lists]

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

bug#25088: 25.1; feature-unload and reload of cl-defstruct fails

From: Eli Zaretskii
Subject: bug#25088: 25.1; feature-unload and reload of cl-defstruct fails
Date: Fri, 02 Dec 2016 10:13:44 +0200

> From: address@hidden
> Date: Fri, 02 Dec 2016 00:24:04 -0500
> Running
>     emacs -Q -l bug-struct-reload.el --eval "(unload-feature 
> 'bug-struct-reload)" -l bug-struct-reload.el
> Where bug-struct-reload.el contains
>     (eval-when-compile (require 'cl-lib))
>     (cl-defstruct foo f1)
>     (provide 'bug-struct-reload)
> Shows in *Messages* the following error
>     Unexpected element (define-type . foo) in load-history
>     Compiler-macro error for foo-p: (void-function foo-p--cmacro) [2 times]
> This is because cl-defstruct defines the field accessors before the
> predicate.  After calling `feature-unload', the `macro-compiler' symbol
> property remains on the predicate even though the function itself is
> undefined.  Then when reloading, the compiler tries to call the
> predicate's compiler-macro to inline it in the accessor function, and
> fails to find the definition.
> Since this is a regression in 25.1, I'd like to apply the following
> patch to emacs-25, which simply puts the predicate definition before the
> accessor functions.

How risky is this change?  cl-defstruct is a very widely used macro,
whereas unload-feature is a relatively obscure feature.  Is it really
worth fixing the (IMO minor) error and risking to break Emacs 25.2?

I don't have an intuition I can trust in these matters, so I need you
and others who do to offer their opinions, after carefully considering
the pros and cons.


reply via email to

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