[Bioc-devel] In praise of name spaces (was: [BioC] expresso still dying on list.files()--solved)

Seth Falcon sfalcon at fhcrc.org
Tue Nov 15 17:07:23 CET 2005

Hi All,

Eric recently solved an issue he was having with the affy package...

On 14 Nov 2005, Eric.Kort at vai.org wrote:
> I have solved this issue with expresso.  The problem was that I am
> a/an <insert preferred derogatory euphemism here> and masked the
> "normalize" function with the little macro function I wrote to
> perform these normalizations.

These sorts of name collisions can be nasty.  There are, however, some
things that package developers can do to make it more difficult for us
<PDE Here> users to mess things up.

One of them is for more packages to use name spaces.  I believe that
Eric's helper function would not have confused affy if the affy package
was using a name space (it will have one in the next release).

So to all those package developers and maintainers on the list: you
may want to consider adding a name space to your package.

Advantages for your package include:

 - Your package won't be broken by "helper" functions that your users
   define in the global name space

 - Your package won't be bothered by functions in other packages with
   the same name.

 - A name space gives you the ability to clearly specify which
   functions are part of the public interface and which are private.
   R CMD check won't bother you for documentation on non-exported
   functions, although it is often still useful to give them some

There are some disadvantages:

 - You have to maintain the NAMESPACE file

 - It is less convenient to debug/develop packages with name spaces
   because you have to run R CMD INSTALL to be sure everything gets
   updated in the name space properly.  Although less convenient, you
   will be more certain that the behavior is really in your package
   and not a result of things hiding in your global workspace.

Finally, an offer of help:

If you would like help adding a name space to your package, let us
know and we will provide assistance.  A great place to start, would be
to send questions to bioc-devel. 

Best Wishes,

+ seth

PS: You can read more about name spaces in the Writing R Extensions Manual

More information about the Bioc-devel mailing list