Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making register() a generic #104

Open
LTLA opened this issue Sep 18, 2019 · 1 comment
Open

Making register() a generic #104

LTLA opened this issue Sep 18, 2019 · 1 comment

Comments

@LTLA
Copy link
Contributor

LTLA commented Sep 18, 2019

BiocNeighbors and BiocSingular follow BiocParallel's paradigm of using *Param objects to specify the algorithm and parameters to use for NN searching and SVD, respectively.

I have recently added a BiocSingular::bsparam() function that returns a "default" Param object, in much the same way that BiocParallel::bpparam() works. The idea is that developers can specify bsparam() in their functions/scripts and it will use a global default value that can be changed by the user. This is more convenient than passing the new Param explicitly to each function.

Currently, I am using a global options() to handle this, but it would be nice to use the BiocParallel::register() interface (and its internal machinery) to manage the setting and getting of the global default. One could imagine making register() an S4 generic, or even better, adding a simple mechanism that allows my packages to save to a different slot of the existing registry.

@DarwinAwardWinner
Copy link

a simple mechanism that allows my packages to save to a different slot of the existing registry.

Wouldn't this effectively just be reimplementing options with maybe slightly different semantics? What would be the advantage register over options here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants