Closed sebffischer closed 7 months ago
Can you provide a reproducible example for this?
library(mlr3misc)
dictionary = Dictionary$new()
dictionary$add("a", function(di) print(dictus))
sgr = function(.key, ...) {
dictionary_sugar_get(dictionary, .key, ...)
}
sgr("a", di = "hallo")
#> Error in dictionary_sugar_get(dictionary, .key, ...): Assertion on 'dict' failed: Must inherit from class 'Dictionary', but has class 'character'.
Created on 2023-07-06 with reprex v2.0.2
The additional di = "hallo"
partially matches the dict
argument from dictionary_sugar_get
.
We could just call the dict
argument .dict
.
Agreed - can you PR this?
We need to sync package releases though: https://github.com/mlr-org/mlr3pipelines/blob/dae03afd8efa83621a495a058f42cfc2ea8d7357/R/ppl.R#L26
Or we add an
if (packageVersion("mlr3") > ...)
use .dict
else
use dict
to the relevant functions
maybe better to create a new function dictionary_sugar_get_safe
and remove the old function after a few versions, this way we don't all have to upload new packages
It is e.g. impossible for a learner with a parameter / field that partially matches
dict
to be set during alrn()
call as the value of this parameter will be used as thedict
argument.