nimble-dev / nimble

The base NIMBLE package for R
http://R-nimble.org
BSD 3-Clause "New" or "Revised" License
160 stars 24 forks source link

add `warn=FALSE` option to `deregisterDistributions`? #1510

Open perrydv opened 3 weeks ago

perrydv commented 3 weeks ago

In looking at user workflow(s), it seems easier sometimes to have deregisterDistributions always called before registerDistributions. That way, if one is coding/debugging, the deregistration will always be done if it's needed. However, the first time through, or if called repeatedly before a fresh call to registerDistributions, it will give a warning that the distribution was not registered. I think it would be nice to offer an argument warn that defaults to TRUE but if FALSE will not emit the warning.

paciorek commented 6 days ago

@perrydv I'm not quite following. If we did try to deregister first automatically presumably we'd want deregisterDistributions to be given a flag to tell it to check to see if the distribution is registered, and if not, to simply return with no action. Then the warning business wouldn't be necessary. I think I'm not seeing something.

perrydv commented 3 hours ago

@paciorek Are we thinking of different flavors of the same idea? I was suggesting that one wants to be able to call deregisterDistributions and not be warned if the distribution wasn't registered anyway. This idea is similar to e.g. the showWarnings argument of dir.create. You are describing an an argument indicating that the call should return with no action if the distribution registered. So in other words you are describing an argument for the user to say they don't want a warning or error. Same thing?