[Bioc-devel] Why BiocGenerics (was Re: parallel package generics)

Cook, Malcolm MEC at stowers.org
Thu Oct 25 23:05:53 CEST 2012



On 10/25/12 2:43 PM, "Martin Morgan" <mtmorgan at fhcrc.org> wrote:

>On 10/25/2012 07:53 PM, Cook, Malcolm wrote:
>> Question: Why do we have BiocGenerics at all?
>>
>> I notice for instance that the definition of Reduce that it provides is
>>different in only one respect from base::Reduce.
>
>For most of the generics the motivation was different -- different
>packages 
>would independently implement S4 generics and methods on them, the
>generics from 
>different packages would mask one another, and the user would be confused
>when 
>the wrong method was chosen.

OK.  Makes sense.  But we are trading a different kind of confusion
perhaps....

>This could still be a case of 'fix it upstream'. The upstream fix is to
>make S4 
>generics of common / all functions.

I don't see why, in the case of mclapply and Reduce, simply NOT coercing
as as.list is not the upstream fix....

...Or, maybe change the test for coercion required to be whether X
implements '[[' and 'length' or not.

>This has costs, in terms of performance and
>perhaps other issues. Also, the stats4 package is an attempt at an
>'upstream' 
>fix where common statistical functions are made into S4 generics.

And did this attempt meet success, do you know?

--Malcolm

>
>It could be the case that some methods could be avoided by appropriate
>(re)-definition of the default
>
>Martin
>-- 
>Computational Biology / Fred Hutchinson Cancer Research Center
>1100 Fairview Ave. N.
>PO Box 19024 Seattle, WA 98109
>
>Location: Arnold Building M1 B861
>Phone: (206) 667-2793



More information about the Bioc-devel mailing list