From jmc at r-project.org  Tue Oct 29 17:54:44 2013
From: jmc at r-project.org (John Chambers)
Date: Tue, 29 Oct 2013 09:54:44 -0700
Subject: [Rd] unloadNamespace,
 getPackageName and "Created a package name xxx " warning
In-Reply-To: <CAMd4_AfUrHaEx0ofnW+YdCxqzFkGm5-O6k3fWTbx+vpYqNKbug@mail.gmail.com>
References: <CAMd4_AfUrHaEx0ofnW+YdCxqzFkGm5-O6k3fWTbx+vpYqNKbug@mail.gmail.com>
Message-ID: <526FE854.9040603@r-project.org>

This was previously reported and fixed.  See the NEWS file and bug 
report 15481.

On 10/29/13 9:19 AM, Karl Forner wrote:
> Dear all,
>
> Consider this code:
>> library("data.table")
>> unloadNamespace('data.table')
>
> It produces some warnings
> Warning in FUN(X[[1L]], ...) :
>    Created a package name, ?2013-10-29 17:05:51?, when none found
> Warning in FUN(X[[1L]], ...) :
>    Created a package name, ?2013-10-29 17:05:51?, when none found
> ...
>
> The warning is produced by the getPackageName() function.
> e.g.
> getPackageName(parent.env(getNamespace('data.table')))
>
> I was wondering what could be done to get rid of these warnings, which I
> believe in the case "unloadNamespace" case are irrelevant.
>
> The stack of calls is:
> # where 3: sapply(where, getPackageName)
> # where 4: findClass(what, classWhere)
> # where 5: .removeSuperclassBackRefs(cl, cldef, searchWhere)
> # where 6: methods:::cacheMetaData(ns, FALSE, ns)
> # where 7: unloadNamespace(pkgname)
>
> So for instance:
>> findClass('data.frame', getNamespace('data.table'))
> generates a warning which once again seems irrelevant.
>
> On the top of my head, I could imagine adding an extra argument to
> getPackageName, say warning = TRUE, which would be set to FALSE in the
> getPackageName call in findClass() body.
>
> I also wonder if in the case of import namespaces, getPackageName() could
> not find a more appropriate name:
>> parent.env(getNamespace('data.table'))
> <environment: 0x7f6ce4d04040>
> attr(,"name")
> [1] "imports:data.table"
>
> This namespace has a name that might be used to generate the package name.
>
> My question is: what should be done ?
>
> Thanks for your attention.
>
> Karl Forner
>
> 	[[alternative HTML version deleted]]
>
>
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



[Rd] unloadNamespace, getPackageName and "Created a package name xxx " warning
John Chambers