Skip to content

Why not default to "globals = FALSE" if sequential or multicore plans? #627

Answered by HenrikBengtsson
scottkosty asked this question in Q&A
Discussion options

You must be logged in to vote

It's mainly due to conservative design decisions + leaving room for future changes;

Having the same defaults for future() regardless of parallel package helps detect developer mistakes early on. For instance, if someone writes code using plan(sequential) and plan(multicore) and fail to consider some globals, then they will go unnoticed until an end-user tries plan(multisession).

Having globals default to TRUE on some backends and FALSE on others might also add confusion. It's always easier to grasp how things work, if they work the same in most cases.

There's also the scenario where a future is created lazily, e.g.

> library("future")
a <- 42
f <- future({ b <- 2; a * b }, globals = FALSE…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by HenrikBengtsson
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants