[Bioc-devel] [BioC] Rgraphviz redefines "head" function

Seth Falcon sfalcon at fhcrc.org
Thu Jun 14 07:17:48 CEST 2007


Thanks for the quick fixes, Herve.  I wanted to add a few comments about
generic functions and since this is more about the development side of
things, I've moved the discussion to bioc-devel.

Herve Pages <hpages at fhcrc.org> writes:
> Hi Marco,
> Thanks for reporting this! Since head/tail are already generics
> defined in the "utils" package, they should not be redefined in
> Rgraphviz. Only methods for "AgEdge" objects should go there.
> I've just fixed this in Rgraphviz 1.14.1 (release) and Rgraphviz
> 1.15.5 (devel). These new versions should become available via
> biocLite() in about 26 hours for the former and 14 hours for the
> latter.

Generic functions are first and foremost _functions_.  Function name
collisions are inevitable.  Even if a developer tries to avoid it,
there are times where such collisions will happen.  There are also
times when choosing a name that is used elsewhere is simply the best
choice because it is the Right Name.

Package namespaces provide a solution here, but it won't always be a
convenient one for users working interactively -- when names collide,
they have to know how to disambiguate, e.g. using '::'.

When considering whether to reuse an existing generic, I think one
should consider:

    - Does the signature of the pre-existing generic match the desired
      signature for your method?

    - Does your method implement the same concept as the generic?

    - Would defining your own generic cause users undo confusion?

In the case of Rgraphviz and head/tail, the signatures match.  
The concepts of the generics are not the same (yes, this is
completely subjective).  But as evidenced by Marco's report, the cost
of user confusion seems high relative to any benefits of defining a
separate generic.  If a different signature would be more natural and
if head/tail were commonly used user-level functions in Rgraphviz, I
would argue differently.  

I think Herve's solution is the right one here, but it is not just
because head/tail are defined elsewhere and not because the symbols in
utils should never be masked.

Thanks for listening :-P

+ seth

Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center

More information about the Bioc-devel mailing list