[Rd] Signature specific S4 Method export in NAMESPACE file would be cool

Markus Mueller mamueller at bgc-jena.mpg.de
Fri Jan 24 23:41:44 CET 2014


Assume that you have a S4 generic function gf(x) and two methods implementing
it,
The first  for x of class A ( gf#A) and
the second for x of class B ( gf#B)

I would very much like to be able to:
1.) export only one method e.g. gf#A to be visible for  users of the package.
2.) hide gf#B automatically when gf is exported but not the class "B"
3.) hide gf#B in the gf-methods.Rd file produced by package.skeleton

More generally  one should of course think about any number of arguments e.g.
 gf(x,y) with y of any of the classes A B or C
and methods:
gf#A#A
gf#A#B
gf#A#C
gf#B#A
...
and so on

I would then like to
1.) export methods only for a list of signatures with
    an extended exportMethod statement in the  the NAMESPACE file .
    whose syntax could look like:

    exportMethod( gf,signatures=list(c(A,B),c(A,C)))

    where the omitted signatures argument defaults to the behavior already
implemented by exportMethods.

2.) hide any method with a signature >>containing<< a non exported class in case
the generic function  is exported
    e.g. if only A is an exported class only gf#A#A would be visible.

3.) as above

Background:
We strive for a weekly release cycle. It helps very much to be able to implement
and test new features without exposing them in the NAMESPACE until we are sure
that they will stay.
Being able to hide specific methods with specific signatures would help to
extend this practice to generic functions
which are quite numerous in our package.


I'm eager to hear about your thoughts.

Thanks in advance for your time.

Markus Müller



More information about the R-devel mailing list