From murdoch.duncan at gmail.com  Sun Jul 17 13:58:21 2011
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Sun, 17 Jul 2011 07:58:21 -0400
Subject: [Rd] NAMESPACE
In-Reply-To: <CAP01uRnFyMXiEWHCLN=Cp9gdHHRw53hTAjucnb=r0c+kU62GhA@mail.gmail.com>
References: <CAP01uRnFyMXiEWHCLN=Cp9gdHHRw53hTAjucnb=r0c+kU62GhA@mail.gmail.com>
Message-ID: <4E22CE5D.4070404@gmail.com>

On 11-07-16 10:13 PM, Gabor Grothendieck wrote:
>> Packages without explicit ?NAMESPACE? files will have a default one created at build or INSTALL time,
>> so all packages will have namespaces. A consequence of this is that ?.First.lib? functions need to be
>> renamed, usually as ?.onLoad? but sometimes as ?.onAttach?.
>
> Couldn't R simply regard .First.lib as the appropriate function to
> save many packages from
> being needlessly changed?
>

It is doing that (see today's version of the NEWS), but the problem is 
that it may choose the wrong one.  If your package requires 
initialization then yourpkg::somefun only works if the initialization 
happens in .onLoad.  But some packages only work if the initialization 
happens when the package is attached.  It's better for the author to 
make the choice than for R to do it automatically.

Duncan Murdoch



[Rd] NAMESPACE
Duncan Murdoch