Still, if pkgA imports the generic from pkgB, then installing pkgA installs 
pkgB and all of its dependencies (Depends and Imports). Which of course makes 
sense (as otherwise pkgB cannot be installed). But all of this just for 
importing

foo <- function(x, ...)
   UseMethod("foo")

from pkgB.

Best,
Wolfgang

>-----Original Message-----
>From: R-package-devel [mailto:r-package-devel-boun...@r-project.org] On
>Behalf Of Duncan Murdoch
>Sent: Tuesday, 23 June, 2020 12:25
>To: Guido Schwarzer; r-package-devel@r-project.org
>Subject: Re: [R-pkg-devel] [External] Re: Two packages with the same generic
>function
>
>On 23/06/2020 4:22 a.m., Guido Schwarzer wrote:
>> Am 23.06.20 um 10:00 schrieb Viechtbauer, Wolfgang (SP):
>>> [...]
>>> @Neal: A separate package with generic functions that pkgA and pkgB could
>import is an interesting suggestion, thanks!
>>
>> What makes this interesting is that there is no dependency on other
>> packages in generics.
>>
>> Remains the question which help page would be shown for help(foo).
>
>If a package imports and then exports the generic, it would normally
>create a help page referring to the original one where the generic is
>defined.  So both pkgA and pkgB would probably both create help pages,
>and the help system would show a page listing them both plus the generic
>one, and asking the user to choose.
>
>An example happens if you use
>
>library(broom)
>?tidy
>
>The broom package links to a page that says "These objects are imported
>from other packages. Follow the links below to see their documentation."
>One of the links is to the ?tidy page in the generics package.
>
>You are allowed to say ?broom::tidy, and then you don't go to the list
>of possibilities, you go directly to the one you asked for.
>
>Duncan Murdoch

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

Reply via email to