[Rd] NAMESPACE Q: does import as exist?
sfalcon at fhcrc.org
Thu Feb 9 17:19:35 CET 2006
Thanks very much for the explanation.
On 8 Feb 2006, luke at stat.uiowa.edu wrote:
> Allowing for renaming complicates the code; it also may prevent, or
> at least significantly complicate, changes in the implementation we
> might want to make.
Makes sense that this feature is not of highest priority. Renaming
will always be available as newFoo <- somePkg::foo. The ability to do
the renaming in the NAMESPACE file has the added advantage of being
declarative. That has value, but certainly one can get by without
Given that newFoo <- somePkg::foo will always work, I would think that
getting it to work in the NAMESPACE file shouldn't add too much
complexity, but I recognize this is a naive view.
> On the other hand this might be quite useful in some settings. We
> had some disagrements about how useful, so the compromise was to
> leave the facility in but not officially document it, and wait and
> see what the need looks like. This is the first request I recall in
> almost three years since the mechanism was introduced, so it is not
> a major issue.
My bias is obvious from this thread; I think this is a valuable
feature and I'm not sure the count of requests in the past 3 yrs is a
fair measure. There is, perhaps, a feedback loop:
more doc (plus beating with sticks) => more use of namespaces
=> more feature requests
In the end, I would like to see more packages use namespaces and I
think this would be helped by more doc and examples.
> So if you want to use this do so with caution. If we see
> substantial usage we may need to think about formally documenting
> and testing this; but only after carefully considering whether it
> does impose limits on other things we would like to do.
That is clear. One last thought that I didn't see mentioned in the
namespace notes on your website:
Is there a way to say in the NAMESPACE file:
I'm going to use pkgFoo, please load the package, but don't import
anything because I will access via pkgFoo::
I realize that '::' will load pkgFoo on demand. My reservation about
using :: is that it is easy to lose track of the fact that my package
needs pkgFoo. I like the idea that all of my package's dependencies
are easily parsable by the system.
Having written that, I realize that the Imports field in DESCRIPTION
gives me a way to do this --- but in an ideal world I would need to
duplicate info from NAMESPACE in DESCRIPTION.
More information about the R-devel