From murdoch.duncan at gmail.com  Wed Apr 29 21:24:02 2015
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Wed, 29 Apr 2015 15:24:02 -0400
Subject: [Rd] R CMD check and missing imports from base packages
In-Reply-To: <CABtg=KkOAdRh_EjDYhj9-AaToMfv0kMWLuD=g=f-aem0GJNndg@mail.gmail.com>
References: <CABtg=K=iq7XVY8NksW-gQq_zr7wk4329Sh67c55JxrFF2HDosQ@mail.gmail.com>	<CAFOpNVEipQH5RMo3nJ3yrUmtkAd-58ZhikSUwcHNijxv=SjKqQ@mail.gmail.com>	<CABtg=Kne=YoFcCJz8ZWd2AviveSQxW+T7NU4rexLMKokpC3ugA@mail.gmail.com>	<CADwqtCNsZgtnbf4hXw5jVLRkr+bOgr7kU68JVRTw9NZc+MyvOQ@mail.gmail.com>
	<CABtg=KkOAdRh_EjDYhj9-AaToMfv0kMWLuD=g=f-aem0GJNndg@mail.gmail.com>
Message-ID: <55412FD2.3060809@gmail.com>

On 29/04/2015 1:57 PM, G?bor Cs?rdi wrote:
> On Wed, Apr 29, 2015 at 1:45 PM, Gabriel Becker <gmbecker at ucdavis.edu>
> wrote:
>
> > Gabor,
> >
> > To play devil's advocate a bit,  why not just have the package formally
> > import the functions it wants to use (or the whole package if that is
> > easier)?
> >
>
> This is exactly my goal. And to facilitate this, R CMD check could remind
> you if you forgot to do the formal import.
>
> You don't want to require people to import things like the assignment
> > operator, or "if", or a bunch of other things in the base package (and
> > probably not the stuff in grDevices either, though from your description
> > they would in principle need to do that now).
> >
>
> I am not talking about the 'base' package, only the other base packages.
> (The base package is special, it is searched before the attached packages,
> so it is probably fine.)
>
> Yes, I suggest people import stuff from grDevices explicitly. Because if
> they don't, their package might break if used together with other packages.
> And this is not a theoretical issue, in the past couple of weeks I have
> seen this happening three times.
>
> But why should stats not require an import if you want to guarantee that
> > you get the density function from stats and not from somewhere else? Isn't
> > that what ImportFrom is for? Is the reason that it is loaded automatically?
> >
>
> That's exactly what I am saying, sorry if it was not clear. I want to
> "require" format imports from base packages (except from _the_ base
> package, maybe).
>
> Yes, people can do this already. But why not help them with a NOTE if they
> don't know that this is good practice, or they just simply forget?

I suspect the reason for this is historical:  at the time that the 
current warning was added, it would have flagged too many packages as 
problematic.  People do complain when base R makes changes that force 
them to change their packages.  Perhaps that decision should be 
reconsidered now.

Duncan Murdoch



[Rd] R CMD check and missing imports from base packages
Duncan Murdoch