Skip to content

Use of requireNamespace() not really needed - can be dropped #21

@HenrikBengtsson

Description

@HenrikBengtsson

Hello, just a drive-by comment. I see you're using requireNamespace() in:

interflex/R/kernel.R

Lines 763 to 768 in e35ba4a

requireNamespace("doParallel")
## require(iterators)
maxcores <- detectCores()
cores <- min(maxcores, cores)
pcl <- future::makeClusterPSOCK(cores)
doParallel::registerDoParallel(pcl)

Note that it makes no difference if you have it or not. If the doParallel package is not installed, then requireNamespace("doParallel") will silently return FALSE and continue. The real test is in doParallel::registerDoParallel(pcl), which will give an error if doParallel is not installed.

I suggest dropping requireNamespace() in these cases, because it has no effect and makes you wonder what the purpose is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions