Another NAMESPACE question, imports and S4

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Another NAMESPACE question, imports and S4

Seth Falcon-2
One more namespaces thread and then I will be quiet for a while ;-)

Should S4 methods be attached to the appropriate generic when a
package is loaded, but not attached?

For example, suppose package 'hello' defines an S4 class Speaker and a
defines a method for the show generic defined in the methods package.
Then package 'goodbye' imports hello and defines a function that
creates a Speaker instance and calls show on it.  

The only way I've found thus far to get the show method defined in
'hello' to get attached to the generic is to exportMethods("show")
from 'goodbye'.  But I don't think I should have to export in order to
import.

I've posted packages hello and goodbye here:
http://bioconductor.fhcrc.org/developers/examples/

To see an example, install both then do:

    > library(goodbye)
    > goodbye()
    An object of class "Speaker"
    Slot "words":
    [1] "Goodbye, world"  

Thanks,

+ seth

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel