Skip to content
Prev 5730 / 12125 Next

[R-pkg-devel] Getting two independent packages with identical S3 generics to dispatch each other's methods

Dear Duncan et al.,

Firstly, my apologies for the duplicated query. It seems that I had
searched everywhere but the mailing list where I asked the question.

Secondly, I was wondering if I could get some indication whether CRAN
would accept a package with the following code and documentation (and
only that):

1) A number of exported generics of the form

summary_formula(object, ..., lhs),
simulate_formula(object, nsim=1, seed=NULL, ..., lhs),
etc.,

which expect a formula as their first argument, evaluate the LHS of the
formula, and dispatch based on the class of the result, which can also
be overridden by the lhs= argument.

2) Corresponding S3 methods summary.formula(), simulate.formula(), etc.
methods, that call the corresponding *_formula() generic.

I am familiar with the generics package, but I don't think it's a good
place for this functionality, because this is not the typical
dispatching behaviour, and because *.formula() exports are not
technically generics but S3 methods. In particular, as far as I know,
existing mechanisms make it easy to cherry-pick generics, but they
don't make it easy to cherry-pick methods.

				Best Regards,
				Pavel
On Sat, 2020-07-11 at 07:29 -0400, Duncan Murdoch wrote: