GNU bug report logs - #67034
30.0.50; Make `derived-mode-p` take a single arg

Previous Next

Package: emacs;

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

Date: Fri, 10 Nov 2023 04:00:02 UTC

Severity: normal

Found in version 30.0.50

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

Bug is archived. No further changes may be made.

Full log


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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Daniel Mendler <mail <at> daniel-mendler.de>
Cc: 67034 <at> debbugs.gnu.org
Subject: Re: bug#67034: 30.0.50; Make `derived-mode-p` take a single arg
Date: Thu, 16 Nov 2023 17:38:00 -0500
> This change would affect many packages. I grepped through my elpa
> directory and found multiple uses of derived-mode-p and
> provided-mode-derived-p with multiple arguments as shortcuts:
>
> (derived-mode-p 'mode1 'mode2) instead of (or (derived-mode-p 'mode1)
> (derived-mode-p 'mode2)

With the new convention the code would be

    (derived-mode-p '(mode1 mode2))

which seems just as good.

> There are also multiple call sites with apply, but these would be
> arguably nicer if derived-mode-p takes a list argument as proposed.

Exactly.

> Still, do the benefits of this change outweigh the required changes?

I think they do, especially since we preserve backward compatibility, so
the change can be done progressively.

> I wonder if this extra allocation of &rest makes any difference in any
> benchmark, though.

I hope not, tho I've seen several situations where the cost of
apply+&rest dominates execution time (mostly because of the time
spent in the GC collecting the allocated cons cells), so it's within the
realm of possible.

Note that the recent introduction of `derived-mode-all-parents` should
already have made `derived-mode-p` faster (tho it wasn't the purpose).


        Stefan





This bug report was last modified 1 year and 182 days ago.

Previous Next


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