[Rd] Another NAMESPACE question, imports and S4

From: Seth Falcon <sfalcon_at_fhcrc.org>
Date: Wed 08 Feb 2006 - 20:05:35 GMT

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"


+ seth

R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu Feb 09 08:07:16 2006

This archive was generated by hypermail 2.1.8 : Fri 10 Feb 2006 - 02:15:50 GMT