Discussion: separate set_package and set_package_path methods
While reviewing #129, @jameslamb had the idea:
ok next idea related to our ongoing discussion today re #106 ....
I think we should make reporters have a set_package and set_package_path separately. DependencyReporter, for example, shouldn't have to care about pkg_path.
Thoughts?
I have two ideas for how to do this:
Idea 1 : Explicit set_package_path method
Only FunctionReporter gets this method. Other ones don't. set_package no longer takes pkg_path as an argument.
Since this breaks the identical interface, but we still want to be able to pass it through in CreatePackageReport, we can do something like:
if (`set_package_path` %in% names(reporter)) {
reporter$set_package_path(pkg_path)
}
So it will only do it for reporters where it finds the method.
Idea 2: Use ... to allow extraneous inputs
set_package has the interface function(pkg_name, ...) so it can take extra arguments without complaining.
Only FunctionReporter will have the interface function(pkg_name, pkg_path, ...). The method will call the inherited super$set_package and then also do its pkg_path stuff.