[Bioc-devel] Problem with generic methods name conflicts

Martin Morgan mtmorgan at fhcrc.org
Thu Oct 13 18:21:59 CEST 2011


On 10/13/2011 08:36 AM, Simon Anders wrote:
> 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.

AllGenerics now defines the generics as

   function(object, ...)

and the replacement generics as

   function(object, ..., value)

Martin

>
> 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
>
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel


-- 
Computational Biology
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109

Location: M1-B861
Telephone: 206 667-2793



More information about the Bioc-devel mailing list