GNU bug report logs - #58563
29.0.50; Generic functions and advertised-calling-convention

Previous Next

Package: emacs;

Reported by: "Basil L. Contovounesios" <contovob <at> tcd.ie>

Date: Sun, 16 Oct 2022 10:25:01 UTC

Severity: normal

Tags: patch

Found in versions 29.0.50, 25.3.1

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 58563 <at> debbugs.gnu.org
Subject: bug#58563: 29.0.50; Generic functions and advertised-calling-convention
Date: Sun, 16 Oct 2022 12:05:33 -0400
> Further to https://bugs.gnu.org/58531#25, generic functions do not
> currently support advertised-calling-convention very well (or vice
> versa).
>
> For example, starting with:
>
>   (cl-defgeneric my-foo (x &optional _y)
>     "Frobnicate X."
>     (declare (advertised-calling-convention (x) "29.1"))
>     x)
>
> Any code that calls my-foo with two arguments correctly gives rise to a
> warning during byte-compilation.

> More importantly, if we now do:
>
>   (cl-defmethod my-foo ((x symbol) &optional _y)
>     "Frobnicate X the symbol."
>     (declare (advertised-calling-convention (x) "29.1"))
>     x)
>
> Then my-foo's symbol-function is overwritten and its entry in
> advertised-signature-table is no longer found, so byte-compilation no
> longer warns about incorrect usage, and C-h f regresses to displaying:

I believe this is now fixed in `master`.

> C-h f also shows the expected arglist, but not for methods:
>
>   my-foo is a Lisp closure.
>   (my-foo X)
>   Frobnicate X.
>   This is a generic function.
>   Implementations:
>   (my-foo X &optional _Y)
>   Undocumented

Not this, OTOH.

> I wonder if cl-defgeneric should be the single source of this function
> property, or whether any cl-defmethod should be able to overload it.
> Thoughts?

The `declare` form on `cl-defmethod`s has been silently ignored until
now.  So I added a compilation warning when we find such a `declare`.


        Stefan





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

Previous Next


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