From sfalcon at fhcrc.org  Wed Feb  8 21:05:35 2006
From: sfalcon at fhcrc.org (Seth Falcon)
Date: Wed, 08 Feb 2006 12:05:35 -0800
Subject: [Rd] Another NAMESPACE question, imports and S4
Message-ID: <m2k6c5boq8.fsf@ziti.local>

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



[Rd] Another NAMESPACE question, imports and S4
Seth Falcon