h2o-3
h2o-3 copied to clipboard
Improve handling of ... (aka 'dots') parameter in R functions
In many places in our R API, the dots parameter is immediately converted to a R list (using list(...)
) which causes the evaluation of all the parameters passed in this dots param and is not a good practice given that R evaluates parameters lazily.
Wherever this is not necessary—it is especially used as a way to deprecate old parameters so they don't appear in signature—, we should try to avoid this kind of conversion and try to maintain the lazy evaluation by using the built-in ...length()
, ...names()
and ...elt(idx)
functions.
See h2o.partialPlot
in models.R
for a proper lazy handling of the dots param.
see discussion https://github.com/h2oai/h2o-3/pull/15895#discussion_r1383176940
Let's try to encapsulate all the deprecation logic into a reusable object/function
Note that ...names()
has been introduced in R v4.1.0 (see https://cran.r-project.org/bin/windows/base/old/4.1.0/NEWS.R-4.1.0.html) so we may not be able to implement this for now.