donyunardi / multiloadr

seamlessly load multiple R packages
Other
2 stars 2 forks source link

use R6? #18

Open donyunardi opened 1 year ago

donyunardi commented 1 year ago

Instead of using the options() to store multiloadr, should we create R6 class instead?

x <- multiloadr$new()

# methods
x$add_pkgs()
x$list_pkgs()
x$load_pkgs()

# constructor
multiloadr_obj <- create_multiloadr(path, pkg_name, branch_name, from_commit) # return multiloadr object
add_pkgs(multiloadr_obj, path, pkg_name, branch_name, from_commit)
list_pkgs(multiloadr_obj)
load_pkgs(multiloadr_obj)
vedhav commented 1 year ago

Totally. I do not like the fact that we're storing the data about the package and paths as options. R6 will make it well isolated.