Skip to content
Prev 18547 / 63424 Next

NAMESPACE, S4, and .onLoad

On Mon, 21 Nov 2005, Seth Falcon wrote:

            
It will do so when the _package_ is loaded, but not when its _namespace_ 
is loaded.  So the advice is correct, as it is always possible that other 
packages will load your package's namespace (via imports) and not 
themselves depend on the 'methods' package and be used in a session with 
a non-default set of packages including 'methods'.  (This is unlikely, of 
course, which is why this may elude detection.)

At one time (and it may still be so) loading the 'methods' namespace and 
not the 'methods' package left R in an internally inconsistent state. 
When I discussed this with John Chambers, his preference was that the 
'methods' package be loaded and attached whenever S4 methods are in use. 
The advice does reflect that (rather than, say, advising that the 
'methods' namespace be imported.)