mlr-org/mlr3misc

dictionary_sugar_get seems to fail when dictionary entries are functions

mb706 opened this issue · 3 comments

mb706 commented
library("mlr3")
rsmp("holdout", x = 1)
#> Error: object of type 'closure' is not subsettable
#> Environment:
#>   1: rsmp("holdout", x = 1)
#>   2: dictionary_sugar_get(mlr_resamplings, .key, ...)
#>   3: stopf("Cannot set argument '%s' for '%s' (not a constructor argument, not a
#>   4: stop(simpleError(str_wrap(sprintf(msg, ...), width = wrap), call = NULL))
#>   5: simpleError(str_wrap(sprintf(msg, ...), width = wrap), call = NULL)
#>   6: structure(list(message = as.character(message), call = call), class = class
#>   7: str_wrap(sprintf(msg, ...), width = wrap)
#>   8: sprintf(msg, ...)
#>   9: did_you_mean(nn, c(constructor_args, param_ids, fields(obj$value)))
#>   10: unique(candidates)
#>   11: fields(obj$value)
#>   12: setdiff(names(x$public_methods), c("initialize", "clone", "print", "format"
#>   13: as.vector(x)

problem seems to be that rsmp()-entries are functions and not R6-constructors, which is explicitly allowed for dictionaries.

mb706 commented

(expected behaviour: "Error Cannot set argument 'x' for 'holdout' ...")

I think this is the same as #115 and was fixed in #116, so it could be closed, @sebfischer? (since you made the fix)

Yes, fixed by #116