Excellent suggestion, Ivan. Thanks for pointing out just where to look.

I stepped through tools::checkS3methods("pomp") and it does appear to be
roughly as I conjectured.  Namely, all functions are extracted from the
pomp namespace and checked against a list of generics.  The check that is
performed is a simple pattern-match (i.e.,
startsWith(paste0(genericname,"."), functionname)).  Clearly this is prone
to false positives.  I wonder what would be involved in tightening this up
so that it agrees with what the actual dispatch mechanism gives....

Interestingly, there is a whitelist, implemented mostly via
tools::nonS3methods().  The function (plyr::rbind.fill) that I had been
importing is there but its replacement (dplyr::bind_rows) is not. So this
answers my original question.

The whitelist appears to be a somewhat arbitrary compilation of functions
from various packages, with no obvious theme.  For example, dplyr is not on
the list, but ElectoGraph is; reshape is on the list but reshape2 is not.
The impression of arbitrariness is reinforced by the fact that packages
that Wickham has for whatever reason decided are superseded are present in
that list and packages he considers for the moment to be worth maintaining
are not.  Doing a quick 'git blame' I see that the whitelist was mostly put
together in 2013, with a few additions in 2015 and much more occasionally
since.

It occurs to me that there ought to be a mechanism whereby a package author
could add to the list of non-S3 methods.  I see from the mailing list
archives that there was discussion of this back in 2015 (
https://stat.ethz.ch/pipermail/r-devel/2015-June/071356.html), with what
looked like consensus that there ought to be such a facility, but nothing
seems to have actually been done about it.  I conjecture that the decision
was to just fold false positives into the whitelist on an ad hoc basis.

Dr. Aaron A. King
University of Michigan


On Fri, Jan 6, 2023 at 3:24 AM Ivan Krylov <krylov.r...@gmail.com> wrote:

> (Sorry for the unfinished message. I've got to do something about my
> mailer to make it harder to send them accidentally.)
>
> On Fri, 6 Jan 2023 11:21:49 +0300
> Ivan Krylov <krylov.r...@gmail.com> wrote:
>
> > to see where 'filter' appears in the list of generics and where the
>
> filter.traj function gets matched to it as a method?
>
> --
> Best regards,
> Ivan
>

        [[alternative HTML version deleted]]

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to