[Rd] "False" warning on "replacing previous import" when re-exporting identical object
Paul Gilbert
pgilbert902 at gmail.com
Fri Aug 30 15:58:24 CEST 2013
This is related to the recent thread on correct NAMESPACE approach when writing S3 methods. If your methods are S4 I think pkgB does not need to export the generic. Just export the method and everything works magically and your problem disappears. For S3 methods there seems to be the difficultly you describe. Of course, the difference between S3 and S4 on this appears somewhat bug like. (I have not tested all this very carefully so I may have something wrong.)
Paul
Henrik Bengtsson <hb at biostat.ucsf.edu> wrote:
>Hi,
>
>SETUP:
>Consider three packages PkgA, PkgB and PkgC.
>
>PkgA defines a generic function foo() and exports it;
>
>export(foo)
>
>PkgB imports PkgA::foo() and re-exports it;
>
>importFrom(PkgA, foo)
>export(foo)
>
>PkgC imports everything from PkgA and PkgB:
>
>imports(PkgA, PkgB)
>
>
>PROBLEM:
>Loading or attaching the namespace of PkgC will generate a warning:
>
> replacing previous import by 'PkgA::foo' when loading 'PkgC'
>
>This in turn causes 'R CMD check' on PkgC to generate a WARNING (no-go at CRAN):
>
>* checking whether package 'PkgC' can be installed ... WARNING
>Found the following significant warnings:
> Warning: replacing previous import by 'PkgA::foo' when loading
>'CellularAutomaton'
>
>
>FALSE?
>Isn't it valid to argue that this is a "false" warning, because
>identical(PkgB::foo, PkgA::foo) is TRUE and therefore has no effect?
>
>
>/Henrik
>
>PS. The above can be avoided by using explicit importFrom() on PkgA
>and PkgB, but that's really tedious. In my case this is out of my
>reach, because I'm the author of PkgA and PkgB but not many of the
>PkgC packages.
>
>______________________________________________
>R-devel at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-devel
More information about the R-devel
mailing list