GNU bug report logs - #56648
29.0.50; Need for `compiled-function-p`

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Tue, 19 Jul 2022 20:44:02 UTC

Severity: wishlist

Found in version 29.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #54 received at 56648 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 56648 <at> debbugs.gnu.org
Subject: Re: bug#56648: 29.0.50; Need for `compiled-function-p`
Date: Sun, 14 Aug 2022 22:36:04 -0400
>> >> -  (or (byte-code-function-p (symbol-function 'byte-compile-form))
>> >> -      (subr-native-elisp-p (symbol-function 'byte-compile-form))
>> >> -      (assq 'byte-code (symbol-function 'byte-compile-form)) <<<<<<<<<<<<<
>> >> +  (or (compiled-function-p (symbol-function 'byte-compile-form))
>> 
>> According to my reading of the code, this `assq` can never return
>> non-nil.
>
> Too bad the commit log message didn't say that, then.  Imagine someone
> 5 or 10 years from now trying to understand the fine points of that
> changeset...

If (assq 'byte-code (symbol-function 'byte-compile-form)) returns
non-nil, it means that the `byte-compile-form` function has been
byte-compiled by the Emacs-18 byte-compiler (the byte-code-function type
was only introduced in Emacs-19).

So `compiled-function-p` *should* replace all 3 cases.

IOW I believe the above diff is "obviously right" and the question is
whether `compiled-function-p` should be changed to return non-nil for
functions of the form (lambda (...) (byte-code ...)), i.e. those
functions generated by Emacs-18's byte-compiler.  I hope we don't need
to keep that backward compatibility, tho ;-)


        Stefan





This bug report was last modified 2 years and 336 days ago.

Previous Next


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