Hi,

I get an error from loadNamespace in the following situation (on R-2.15.3,
R-devel 2013-03-26 r62409, and fresh R-3.0.0):

- package A has an optional (suggests) dependency to package C, which is
tested at load time in .onLoad, via require().
- package B depends on package A, which is loaded when B is lazy-loaded at
install time.
- package B is installed with package C installed

If one now removes package C and try loading package B via library(B), then
one gets an error such as:

Error in loadNamespace(name) : there is no package called ‘C’
Error: package/namespace load failed for ‘B’

I guess this is because the list of namespaces to load for B is taken from
the frozen list defined after lazyload at install time.
Is this an intentional requirement or shouldn't the list of dependency
namespaces to load be taken from the NAMESPACE and/or DESCRIPTION file,
which define the true dependencies?

Package B should not have to be aware of how/when the optional dependencies
of package A are  loaded. I believe these are legally conditionally loaded
in .onLoad or should they be loaded in .onAttach?
One could imagine a situation where a package actually does require the
extra functionality provided by package C, at lazy-load time, which means
it must be loaded via .onLoad (right?). In this case, clearly, one would
have package C as Depends, which then would not give rise to the issue I
have here.

Thank you.

Bests,
Renaud

	[[alternative HTML version deleted]]

