[Bioc-devel] Problem with generic methods name conflicts
Simon Anders
anders at embl.de
Thu Oct 13 17:36:54 CEST 2011
Dear Kaspar and Herb
On 2011-10-13 17:14, Kasper Daniel Hansen wrote:
> Second I will note (like you have already noticed) that this is a
> recent addition to Biobase, seemingly coming from the DEseq crowd and
> that this particular generic is not used at all in Biobase, it just
> contains the generic.
>
> The best solution to this is of course to agree with the other
> package(s) about the signature of the generic. You are using
> object, ...
> which to me seems very nice. Biobase is using
> cds, normalized=TRUE
> To me it seems that "object" works better as the function argument of
> a generic, and that you are right in adding the .... Also,
> "normalized=TRUE" seems (to me) to be something that really belongs in
> the individual method (is this really relevant for all signatures?),
> so my suggestion would be to adapt your generic into Biobase. It
I fully agree. Please change the definition in Biobase to
"counts( object, ...)" and I'll change DESeq/DEXSeq accordingly. That
the specialized argument 'normalized' turned up in Biobase was an oversight.
To get back to the general discussion: It is an unfortunate property of
CLOS and S4 that a generic function needs to be defined before one can
define methods; other language demonstrate that this requirement is not
needed. (Compare with overloading in C++; the reason we have it in
CLOS/S4 is, as far as I understand it, solely that the construction
allowed to add methods without modifying the core language.)
Hence, it seems reasonable to consider the definition of a generic as a
mere formality without semantic context. This is especially true if
multiple dispatch is not needed, because then, the standard signature
"object, ..." will always to the job. Hence, we could make it a policy
that whenever two packages both wish to define methods for a generic f,
we simply define one in Biobase (or maybe, in BiocGenerics) with always
the same standard signature "object, ...".
Simon
More information about the Bioc-devel
mailing list