From nalimilan at club.fr  Sat Dec 15 17:59:56 2012
From: nalimilan at club.fr (Milan Bouchet-Valat)
Date: Sat, 15 Dec 2012 17:59:56 +0100
Subject: [Rd] R CMD INSTALL warnings with conflicting imports
Message-ID: <1355590796.14652.102.camel@milan>

Hi!

This is an issue we encountered when trying to move the Rcmdr package
from the Depends to the Imports field for RcmrPlugin.* plug-in packages.

Rcmdr overrides a few functions from the tcltk package for convenience.
With the current approach, both Rcmdr and tcltk are in the Depends
field, and no warning is printed. When moving them to Imports, and
adding an import(tcltk, Rcmdr) directive to NAMESPACE, we get this
printed *twice* when running R CMD INSTALL:
> Warning messages:
> 1: replacing previous import ?tclvalue? when loading ?Rcmdr?
> 2: replacing previous import ?tkfocus? when loading ?Rcmdr?
> 3: replacing previous import ?ttkentry? when loading ?Rcmdr?
> 4: replacing previous import ?ttkframe? when loading ?Rcmdr?
> 5: replacing previous import ?ttkradiobutton? when loading ?Rcmdr?
> 6: replacing previous import ?ttkscrollbar? when loading ?Rcmdr?

The solution we found is to use importFrom(tcltk, ...) to only import
tcltk fonctions that do not conflict with those exported by Rcmdr. This
works, but is slightly more painful than the old way, since a typical
plugin uses quite a few tcltk functions.


So I wonder what's the rationale behind the warning. Package maintainers
can perfectly control which package's conflicting functions will
override the other's, by specifying the right order in the import()
directive. If they get the order wrong, the failure will be obvious to
them. It does not seem useful to print warnings when installing
packages, because it's not intended at users. If anything, these
warnings would better be reported by R CMD check only.

If the current situation is judged correct, the solution I describe
works for us. I'd just want to be sure I'm not missing something.

Thanks for your work



[Rd] R CMD INSTALL warnings with conflicting imports
Milan Bouchet-Valat