steve-the-bayesian / BOOM

A C++ library for Bayesian modeling, mainly through Markov chain Monte Carlo, but with a few other methods supported. BOOM = "Bayesian Object Oriented Modeling". It is also the sound your computer makes when it crashes.
GNU Lesser General Public License v2.1
35 stars 14 forks source link

R pkgs: consider moving dependencies to `Imports` instead of `Depends` #67

Open dpprdan opened 1 year ago

dpprdan commented 1 year ago

Boom (and by extension bsts and BoomSpikeSlab) Depends on MASS instead of importing it. Would you consider putting MASS in Imports instead of Depends? (And also the other packages in Depends in bsts and BoomSpikeSlab?)

From R Packages:

The main difference is that where Imports just loads the package, Depends attaches it. There are no other differences. [...] Unless there is a good reason otherwise, you should always list packages in Imports not Depends. That's because a good package is self-contained, and minimises changes to the global environment (including the search path).

Or from WRE:

Field ‘Depends’ should nowadays be used rarely, only for packages which are intended to be put on the search path to make their facilities available to the end user (and not to the package itself)

The main issue is that Depends messes up the search path with packages not explicitly attached by the user. The only upside of Depends is that the package user can call functions from the (implicitly) attached package. But in this case it is not strictly necessary for users of Boom (or bsts) to call functions from MASS.

For a more in-depth treatment see also https://github.com/leeper/Depends