Skip to content
Prev 10956 / 63421 Next

initialization of S4 classes/methods

"A.J. Rossini" wrote:
Yes.  See below.  Does this actually cause problems later on?  When
methods are dispatched, it's likely that "exprSet" will be found.
Not exactly.  The problem is one of the behavior of require() combined
with rules for parents of environments; it's bitten us before, but so
far hasn't been fixed.

1.  The effect of require() is to put Biobase on the search path
_before_ marrayClasses, whereas in the case that library(Biobase) has
been done previously, the opposite is true.

2.  In looking for the definiton of class exprSet, the call to exists
from setMethod will start with the environment of package marrayClasses
and search through the chain of parent environments; i.e., all the
packages _after_ marrayClasses in the search list.  And so it doesn't
find class "exprSet".

It's possible to hack our way around point 2 (by having a special case
for the environment not being a namespace), but point 1 seems not quite
correct.  For example, if the owner of marrayClasses wanted to
deliberately override an object in Biobase, require() would prevent it. 
(Not that overriding is necessarily a good practice, but it should
either work or be an error.)
 
John