Skip to content
Prev 42267 / 63424 Next

A: ImportFrom(B, ...) -- B: ImportFrom(A, ...)

It is necessary (in most cases, and as implemented).

When R goes to load the namespace of A, it has to find the objects you 
wish to import from B.  Remember that objects in R are not standalone: 
they may have shared components and functions have environments, so the 
only way to so this is to load the whole of their environment, the 
namespace of B.  That would lead to a cycle.

importFrom() differs from import() only in what it copies into A's 
'import' environment.

Remember too that namespaces can re-export imports (e.g. S4 generics), 
and that loading a namespace may load compiled code which may have 
dependencies (your examples do) for which order may matter.
On 14/01/2012 21:54, Martin Maechler wrote: