Subject: Re: bug#56340: Change erc dependencies

From: "J.P." <[email-masked]>
Date: Mon, 04 Jul 2022 23:39:07 -0700

"J.P." <[email-masked]> writes:

>> +(declare-function erc-nickname-in-use "erc")
>>  (define-erc-response-handler (433)
>> -  "Login-time \"nick in use\"." nil
>> -  (erc-nickname-in-use (cadr (erc-response.command-args parsed))
>> -                       "already in use"))
>> +                             "Login-time \"nick in use\"." nil
>> +                             (erc-nickname-in-use (cadr (erc-response.command-args parsed))
>> +                                                  "already in use"))
>
> Indentation thing aside, I wasn't aware we were allowed to forgo
> including signatures in these `declare-function' forms. But if that's
> the deal, I guess it makes for a cleaner, less cluttered look overall.
>
> [...]
>
>       Which gets me wondering (not for the first time): all these
> `defvar's and `declare-function's seem a bit litter-prone, no? Not sure
> if any diagnostic tooling already catches extraneous ones orphaned by
> refactoring, but I for one could use such a feature.

Hmm, now I'm thinking there's likely some benefit to always including a
lambda list in these `declare-function's because it seems

1. byte compiling only warns of a mismatch between the call site
   and the declaration but doesn't actually validate the latter

2. check-declare makes up for that by emitting an "arglist mismatch"
   when necessary, which diagnostic tools, like flymake, can pick up on

Not saying you need to comply, but someone should probably at least
append a (t t) to the following declarations because, at present, with
your patch applied, running `check-declare-directory' on lisp/erc gives:

  lisp/erc/erc-networks.el:1099:Warning (check-declare): said
      ‘erc--target-channel-local-p’ was defined in lisp/erc/erc.el:
      function not found
  lisp/erc/erc-networks.el:1100:Warning (check-declare): said
      ‘erc--target-symbol’ was defined in lisp/erc/erc.el:
      function not found
  lisp/erc/erc-networks.el:1101:Warning (check-declare): said
      ‘erc--target-string’ was defined in lisp/erc/erc.el:
      function not found
  lisp/erc/erc-goodies.el:201:Warning (check-declare): said
      ‘erc-input-string’ was defined in lisp/erc/erc.el: function not
      found
  lisp/erc/erc-goodies.el:356:Warning (check-declare): said ‘erc-log’ was
      defined in lisp/erc/erc.el: function not found
  lisp/erc/erc-backend.el:613:Warning (check-declare): said
      ‘erc-networks--id-given’ was defined in lisp/erc/erc.el:
      function not found
  lisp/erc/erc-backend.el:647:Warning (check-declare): said ‘erc-log’ was
      defined in lisp/erc/erc.el:
      function not found
  lisp/erc/erc-backend.el:1705:Warning (check-declare): said
      ‘erc-get-channel-user’ was defined in lisp/erc/erc.el:
      function not found

Perhaps the definitions of these irregulars should all eventually be
moved to erc-backend.el, as you did with `erc-input'.

In the meantime, I'm going to extract the non-forward-declaration hunks
from your patch into a standalone commit (attributed to you, unless you
object relatively soonish) and install that along with some other,
unrelated fixes. That way, we can let the rest steep until others weigh
in or at least until there's some clear indication of your willingness
to iterate further on this bug thread (apart from related activity on
your fork). Thanks.