Skip to content
Prev 51259 / 63435 Next

Best way to implement optional functions?

On 22 October 2015 at 22:55, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
I had the same issue with the assertive package: it was getting big,
and not everyone wanted all the functionality.

The solution was to create several smaller packages with individual
components of functionality, for example assertive.base contains the
bare-minimum functionality; assertive.numbers contains functionality
related to numbers, etc.

Then the assertive package imports all the functions from the
component packages and reexports them.

That way people who want a small footprint (mostly other package
developers) can specify only what they need, and people who don't care
(mostly end users) can just type library(assertive) and get access to
everything.