Running ‘DEPRECATED.R’
  Running ‘doRNG,dopar.R’
  Running ‘doRNG,dorng.R’ [14s/14s]
  Running ‘foreach,errors.R’ [14s/17s]
  Running ‘foreach,globals.R’
  Running ‘foreach,nested.R’ [20s/20s]
  Running ‘foreach,nested_dopar.R’ [31s/28s]
  Running ‘foreach.R’
  Running ‘future.BatchJobs.R’
  Running ‘future.batchtools.R’
  Running ‘options.R’
  Running ‘registerDoFuture.R’
  Running ‘times.R’
  Running ‘zzz_opt-in,NMF.R’
  Running ‘zzz_opt-in,TSP.R’
  Running ‘zzz_opt-in,caret.R’
  Running ‘zzz_opt-in,foreach.R’
  Running ‘zzz_opt-in,glmnet.R’
  Running ‘zzz_opt-in,plyr.R’
Running the tests in ‘tests/foreach,nested_dopar.R’ failed.
Complete output:
  > source("incl/start.R")
  Loading required package: future
  Loading required package: foreach
  Loading required package: iterators
  Loading required package: parallel
  plan(): nbrOfWorkers() = 1
  > 
  > strategies <- future:::supportedStrategies()
  > strategies <- setdiff(strategies, "multiprocess")
  > 
  > message("*** doFuture - nested %dopar% ...")
  *** doFuture - nested %dopar% ...
  > 
  > registerDoFuture()
  > 
  > message("*** doFuture - nested %dopar%  and tricky globals ...")
  *** doFuture - nested %dopar%  and tricky globals ...
  > 
  > ## This works ...
  > x <- foreach(j = 1) %dopar% { j }
  doFuture() ...
  - dummy globals (as locals): [1] 'j'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          j <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              j
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Searching for globals ...
  - globals found: [14] '{', '::', 'lapply', 'seq_along', '...future.x_ii', '<-', '[[', 'environment', 'local', 'for', 'names', 'assign', 'tryCatch', 'identity'
  Searching for globals ... DONE
  Resolving globals: FALSE
  The total size of the 1 globals is 0 bytes (0 bytes)
  - globals: [1] '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [1] '...future.x_ii'
  List of 1
   $ ...future.x_ii: NULL
   - attr(*, "where")=List of 1
    ..$ ...future.x_ii:<environment: 8e6f250> 
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 0
    - packages: [0] 
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          j <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              j
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 1
  Number of futures (= number of chunks): 1
  Launching 1 futures (chunks) ...
  Chunk #1 of 1 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [1] '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 1 globals is 36 bytes (36 bytes)
  - globals: [1] '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 0): <none>
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = NULL, 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  has_future <- requireNamespace("future", quietly = TRUE)
                  version <- if (has_future) 
                    packageVersion("future")
                  else NULL
                  if (!has_future || version < "1.8.0") {
                    info <- c(r_version = gsub("R version ", "", 
                      R.version$version.string), platform = sprintf("%s (%s-bit)", 
                      R.version$platform, 8 * .Machine$sizeof.pointer), 
                      os = paste(Sys.info()[c("sysname", "release", 
                        "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                    info <- sprintf("%s: %s", names(info), info)
                    info <- paste(info, collapse = "; ")
                    if (!has_future) {
                      msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                        info)
                    }
                    else {
                      msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                        info, version)
                    }
                    stop(msg)
                  }
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  j <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    j
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, local = TRUE, earlySignal = FALSE, 
                    label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    local <- as.logical(local)
                    future <- SequentialFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, local = local, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  plan(): nbrOfWorkers() = 1
  SequentialFuture started (and completed)
  Chunk #1 of 1 ... DONE
  Launching 1 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 1
  
   length: 0 (resolved future 1)
  resolve() on list ... DONE
  - collecting values of future
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  > str(x)
  List of 1
   $ : num 1
  > rm(list = "x")
  > 
  > ## ... but this would give a "globals-not-found" error in
  > ## doFuture (<= 0.4.0) because 'j' was interpreted as global variable
  > x <- foreach(i = 1, .packages = "foreach") %dopar% {
  +   foreach(j = 1) %dopar% { j }
  + }
  doFuture() ...
  - dummy globals (as locals): [1] 'i'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          i <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  foreach(j = 1) %dopar% {
                    j
                  }
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Searching for globals ...
  - globals found: [18] '{', '::', 'lapply', 'seq_along', '...future.x_ii', '<-', '[[', 'environment', 'local', 'for', 'names', 'assign', 'tryCatch', 'library', '%dopar%', 'foreach', 'j', 'identity'
  Searching for globals ... DONE
  Resolving globals: FALSE
  The total size of the 1 globals is 0 bytes (0 bytes)
  - globals: [1] '...future.x_ii'
  - packages: [1] 'foreach'
  getGlobalsAndPackages() ... DONE
    - globals: [1] '...future.x_ii'
  List of 1
   $ ...future.x_ii: NULL
   - attr(*, "where")=List of 1
    ..$ ...future.x_ii:<environment: 8f31de8> 
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 0
    - packages: [1] 'foreach'
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          i <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  foreach(j = 1) %dopar% {
                    j
                  }
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 1
  Number of futures (= number of chunks): 1
  Launching 1 futures (chunks) ...
  Chunk #1 of 1 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [1] '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 1 globals is 36 bytes (36 bytes)
  - globals: [1] '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 1): 'foreach'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    has_future <- requireNamespace("future", quietly = TRUE)
                    version <- if (has_future) 
                      packageVersion("future")
                    else NULL
                    if (!has_future || version < "1.8.0") {
                      info <- c(r_version = gsub("R version ", 
                        "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                        R.version$platform, 8 * .Machine$sizeof.pointer), 
                        os = paste(Sys.info()[c("sysname", "release", 
                          "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                      info <- sprintf("%s: %s", names(info), info)
                      info <- paste(info, collapse = "; ")
                      if (!has_future) {
                        msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                          info)
                      }
                      else {
                        msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                          info, version)
                      }
                      stop(msg)
                    }
                  }
                  local({
                    for (pkg in "foreach") {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  i <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    library("foreach")
                    {
                      foreach(j = 1) %dopar% {
                        j
                      }
                    }
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, local = TRUE, earlySignal = FALSE, 
                    label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    local <- as.logical(local)
                    future <- SequentialFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, local = local, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  plan(): nbrOfWorkers() = 1
  doFuture() ...
  - dummy globals (as locals): [1] 'j'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          j <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              j
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Searching for globals ...
  - globals found: [14] '{', '::', 'lapply', 'seq_along', '...future.x_ii', '<-', '[[', 'environment', 'local', 'for', 'names', 'assign', 'tryCatch', 'identity'
  Searching for globals ... DONE
  Resolving globals: FALSE
  The total size of the 1 globals is 0 bytes (0 bytes)
  - globals: [1] '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [1] '...future.x_ii'
  List of 1
   $ ...future.x_ii: NULL
   - attr(*, "where")=List of 1
    ..$ ...future.x_ii:<environment: 9c2e500> 
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 0
    - packages: [0] 
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          j <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              j
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 1
  Number of futures (= number of chunks): 1
  Launching 1 futures (chunks) ...
  Chunk #1 of 1 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [1] '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 1 globals is 36 bytes (36 bytes)
  - globals: [1] '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 0): <none>
  plan(): nbrOfWorkers() = 1
  SequentialFuture started (and completed)
  Chunk #1 of 1 ... DONE
  Launching 1 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 1
  
   length: 0 (resolved future 1)
  resolve() on list ... DONE
  - collecting values of future
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  SequentialFuture started (and completed)
  Chunk #1 of 1 ... DONE
  Launching 1 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 1
  
   length: 0 (resolved future 1)
  resolve() on list ... DONE
  - collecting values of future
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  has_future <- requireNamespace("future", quietly = TRUE)
                  version <- if (has_future) 
                    packageVersion("future")
                  else NULL
                  if (!has_future || version < "1.8.0") {
                    info <- c(r_version = gsub("R version ", "", 
                      R.version$version.string), platform = sprintf("%s (%s-bit)", 
                      R.version$platform, 8 * .Machine$sizeof.pointer), 
                      os = paste(Sys.info()[c("sysname", "release", 
                        "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                    info <- sprintf("%s: %s", names(info), info)
                    info <- paste(info, collapse = "; ")
                    if (!has_future) {
                      msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                        info)
                    }
                    else {
                      msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                        info, version)
                    }
                    stop(msg)
                  }
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  j <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    j
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, local = TRUE, earlySignal = FALSE, 
                    label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    local <- as.logical(local)
                    future <- SequentialFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, local = local, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  > str(x)
  List of 1
   $ :List of 1
    ..$ : num 1
  > rm(list = "x")
  > 
  > message("*** doFuture - nested %dopar%  and tricky globals ... DONE")
  *** doFuture - nested %dopar%  and tricky globals ... DONE
  > 
  > 
  > for (strategy1 in strategies) {
  +   for (strategy2 in strategies) {
  +     message(sprintf("- plan(list('%s', '%s')) ...", strategy1, strategy2))
  +     plan(list(a = strategy1, b = strategy2))
  +     nested <- plan("list")
  + 
  +     as <- 1:2
  +     bs <- 3:1
  + 
  +     stopifnot(!exists("a", inherits = FALSE), !exists("b", inherits = FALSE))
  + 
  +     message("foreach() - level 1 ...")
  +     x <- foreach(a = as, .export = c("bs", "strategy2"),
  +                  .packages = "foreach") %dopar% {
  +       plan <- future::plan()
  +       stopifnot(inherits(plan, strategy2))
  +       plan_a <- future::plan("list")
  +       str(plan_a)
  +       stopifnot(inherits(plan_a[[1]], strategy2))
  + 
  +       message("foreach() - level 2 ...")
  +       y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% {
  +         plan <- future::plan()
  +         message(capture.output(print(plan)))
  +         stopifnot(
  +           inherits(plan, "future"),
  +           inherits(plan, getOption("future.default", "sequential"))
  +         )
  + 
  +         plan_b <- future::plan("list")
  +         str(plan_b)
  +         stopifnot(
  +           inherits(plan_b[[1]], "future"),
  +           inherits(plan_b[[1]], getOption("future.default", "sequential"))
  +         )
  + 
  +         list(a = a, plan_a = plan_a,
  +              b = b, plan_b = plan_b)
  +       }
  +       message("foreach() - level 2 ... DONE")
  + 
  +       y
  +     }
  +     message("foreach() - level 1 ... DONE")
  + 
  +     local({
  +       stopifnot(length(x) == length(as))
  +       for (aa in seq_along(as)) {
  +         x_aa <- x[[aa]]
  +         stopifnot(length(x_aa) == length(bs))
  +         a <- as[aa]
  +         for (bb in seq_along(bs)) {
  +           x_aa_bb <- x_aa[[bb]]
  +           b <- bs[bb]
  +           stopifnot(
  +             length(x_aa_bb) == 4L,
  +             all(names(x_aa_bb) == c("a", "plan_a", "b", "plan_b")),
  +             x_aa_bb$a == a,
  +             x_aa_bb$b == b,
  +             inherits(x_aa_bb$plan_a[[1]], strategy2),
  +             inherits(x_aa_bb$plan_b[[1]], "future"),
  +             inherits(x_aa_bb$plan_b[[1]],
  +                      getOption("future.default", "sequential"))
  +           )
  +         }
  +       }
  +     })
  + 
  +     ## Cleanup in order make sure none of these variables exist as
  +     ## proxies for missing globals of the name names
  +     rm(list = c("as", "bs", "x"))
  +     message(sprintf("- plan(list('%s', '%s')) ... DONE", strategy1, strategy2))
  +   }
  + }
  - plan(list('sequential', 'sequential')) ...
  plan(): nbrOfWorkers() = 1
  foreach() - level 1 ...
  doFuture() ...
  - dummy globals (as locals): [1] 'a'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  The total size of the 3 globals is 124 bytes (124 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  List of 3
   $ bs            : int [1:3] 3 2 1
   $ strategy2     : chr "sequential"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ bs            :<environment: R_GlobalEnv> 
    ..$ strategy2     :<environment: R_GlobalEnv> 
    ..$ ...future.x_ii:<environment: 98bec10> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 124
    - packages: [1] 'foreach'
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 1
  Number of futures (= number of chunks): 1
  Launching 1 futures (chunks) ...
  Chunk #1 of 1 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 196 bytes (196 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 1): 'foreach'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    has_future <- requireNamespace("future", quietly = TRUE)
                    version <- if (has_future) 
                      packageVersion("future")
                    else NULL
                    if (!has_future || version < "1.8.0") {
                      info <- c(r_version = gsub("R version ", 
                        "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                        R.version$platform, 8 * .Machine$sizeof.pointer), 
                        os = paste(Sys.info()[c("sysname", "release", 
                          "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                      info <- sprintf("%s: %s", names(info), info)
                      info <- paste(info, collapse = "; ")
                      if (!has_future) {
                        msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                          info)
                      }
                      else {
                        msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                          info, version)
                      }
                      stop(msg)
                    }
                  }
                  local({
                    for (pkg in c("future", "foreach")) {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, local = TRUE, earlySignal = FALSE, 
                  label = NULL, ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  local <- as.logical(local)
                  future <- SequentialFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, local = local, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  a <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    library("foreach")
                    {
                      plan <- future::plan()
                      stopifnot(inherits(plan, strategy2))
                      plan_a <- future::plan("list")
                      str(plan_a)
                      stopifnot(inherits(plan_a[[1]], strategy2))
                      message("foreach() - level 2 ...")
                      y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                        {
                          plan <- future::plan()
                          message(capture.output(print(plan)))
                          stopifnot(inherits(plan, "future"), inherits(plan, 
                            getOption("future.default", "sequential")))
                          plan_b <- future::plan("list")
                          str(plan_b)
                          stopifnot(inherits(plan_b[[1]], "future"), 
                            inherits(plan_b[[1]], getOption("future.default", 
                              "sequential")))
                          list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                        }
                      message("foreach() - level 2 ... DONE")
                      y
                    }
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, local = TRUE, earlySignal = FALSE, 
                    label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    local <- as.logical(local)
                    future <- SequentialFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, local = local, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, local = TRUE, earlySignal = FALSE, 
                    label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    local <- as.logical(local)
                    future <- SequentialFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, local = local, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  foreach() - level 2 ...
  doFuture() ...
  - dummy globals (as locals): [1] 'b'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  The total size of the 3 globals is 22.75 KiB (23300 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'a', 'plan_a', '...future.x_ii'
  List of 3
   $ a             : int 1
   $ plan_a        :List of 1
    ..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    .. ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    .. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
    ..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ a             :<environment: 9b53768> 
    ..$ plan_a        :<environment: 9b53768> 
    ..$ ...future.x_ii:<environment: 9c4c4a8> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 23300
    - packages: [0] 
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 1
  Number of futures (= number of chunks): 1
  Launching 1 futures (chunks) ...
  Chunk #1 of 1 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 22.86 KiB (23408 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 0): <none>
  plan(): nbrOfWorkers() = 1
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  SequentialFuture started (and completed)
  Chunk #1 of 1 ... DONE
  Launching 1 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 1
  
   length: 0 (resolved future 1)
  resolve() on list ... DONE
  - collecting values of future
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 2 ... DONE
  foreach() - level 2 ...
  doFuture() ...
  - dummy globals (as locals): [1] 'b'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  The total size of the 3 globals is 22.75 KiB (23300 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'a', 'plan_a', '...future.x_ii'
  List of 3
   $ a             : int 2
   $ plan_a        :List of 1
    ..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    .. ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    .. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
    ..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ a             :<environment: a3613f0> 
    ..$ plan_a        :<environment: a3613f0> 
    ..$ ...future.x_ii:<environment: 9c7f8f8> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 23300
    - packages: [0] 
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 1
  Number of futures (= number of chunks): 1
  Launching 1 futures (chunks) ...
  Chunk #1 of 1 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 22.86 KiB (23408 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 0): <none>
  plan(): nbrOfWorkers() = 1
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  SequentialFuture started (and completed)
  Chunk #1 of 1 ... DONE
  Launching 1 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 1
  
   length: 0 (resolved future 1)
  resolve() on list ... DONE
  - collecting values of future
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 2 ... DONE
  SequentialFuture started (and completed)
  Chunk #1 of 1 ... DONE
  Launching 1 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 1
  
   length: 0 (resolved future 1)
  resolve() on list ... DONE
  - collecting values of future
  List of 1
   $ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  has_future <- requireNamespace("future", quietly = TRUE)
                  version <- if (has_future) 
                    packageVersion("future")
                  else NULL
                  if (!has_future || version < "1.8.0") {
                    info <- c(r_version = gsub("R version ", "", 
                      R.version$version.string), platform = sprintf("%s (%s-bit)", 
                      R.version$platform, 8 * .Machine$sizeof.pointer), 
                      os = paste(Sys.info()[c("sysname", "release", 
                        "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                    info <- sprintf("%s: %s", names(info), info)
                    info <- paste(info, collapse = "; ")
                    if (!has_future) {
                      msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                        info)
                    }
                    else {
                      msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                        info, version)
                    }
                    stop(msg)
                  }
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  b <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    plan <- future::plan()
                    message(capture.output(print(plan)))
                    stopifnot(inherits(plan, "future"), inherits(plan, 
                      getOption("future.default", "sequential")))
                    plan_b <- future::plan("list")
                    str(plan_b)
                    stopifnot(inherits(plan_b[[1]], "future"), 
                      inherits(plan_b[[1]], getOption("future.default", 
                        "sequential")))
                    list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, local = TRUE, earlySignal = FALSE, 
                    label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    local <- as.logical(local)
                    future <- SequentialFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, local = local, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  has_future <- requireNamespace("future", quietly = TRUE)
                  version <- if (has_future) 
                    packageVersion("future")
                  else NULL
                  if (!has_future || version < "1.8.0") {
                    info <- c(r_version = gsub("R version ", "", 
                      R.version$version.string), platform = sprintf("%s (%s-bit)", 
                      R.version$platform, 8 * .Machine$sizeof.pointer), 
                      os = paste(Sys.info()[c("sysname", "release", 
                        "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                    info <- sprintf("%s: %s", names(info), info)
                    info <- paste(info, collapse = "; ")
                    if (!has_future) {
                      msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                        info)
                    }
                    else {
                      msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                        info, version)
                    }
                    stop(msg)
                  }
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  b <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    plan <- future::plan()
                    message(capture.output(print(plan)))
                    stopifnot(inherits(plan, "future"), inherits(plan, 
                      getOption("future.default", "sequential")))
                    plan_b <- future::plan("list")
                    str(plan_b)
                    stopifnot(inherits(plan_b[[1]], "future"), 
                      inherits(plan_b[[1]], getOption("future.default", 
                        "sequential")))
                    list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, local = TRUE, earlySignal = FALSE, 
                    label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    local <- as.logical(local)
                    future <- SequentialFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, local = local, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 1 ... DONE
  - plan(list('sequential', 'sequential')) ... DONE
  - plan(list('sequential', 'multicore')) ...
  plan(): nbrOfWorkers() = 1
  foreach() - level 1 ...
  doFuture() ...
  - dummy globals (as locals): [1] 'a'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  The total size of the 3 globals is 124 bytes (124 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  List of 3
   $ bs            : int [1:3] 3 2 1
   $ strategy2     : chr "multicore"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ bs            :<environment: R_GlobalEnv> 
    ..$ strategy2     :<environment: R_GlobalEnv> 
    ..$ ...future.x_ii:<environment: 953a258> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 124
    - packages: [1] 'foreach'
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 1
  Number of futures (= number of chunks): 1
  Launching 1 futures (chunks) ...
  Chunk #1 of 1 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 196 bytes (196 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 1): 'foreach'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    has_future <- requireNamespace("future", quietly = TRUE)
                    version <- if (has_future) 
                      packageVersion("future")
                    else NULL
                    if (!has_future || version < "1.8.0") {
                      info <- c(r_version = gsub("R version ", 
                        "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                        R.version$platform, 8 * .Machine$sizeof.pointer), 
                        os = paste(Sys.info()[c("sysname", "release", 
                          "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                      info <- sprintf("%s: %s", names(info), info)
                      info <- paste(info, collapse = "; ")
                      if (!has_future) {
                        msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                          info)
                      }
                      else {
                        msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                          info, version)
                      }
                      stop(msg)
                    }
                  }
                  local({
                    for (pkg in c("future", "foreach")) {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, workers = availableCores(constraints = "multicore"), 
                  earlySignal = FALSE, label = NULL, ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  if (is.function(workers)) 
                    workers <- workers()
                  workers <- as.integer(workers)
                  stop_if_not(is.finite(workers), workers >= 1L)
                  if (workers == 1L || !supportsMulticore()) {
                    return(sequential(expr, envir = envir, substitute = FALSE, 
                      lazy = lazy, seed = seed, globals = globals, 
                      local = TRUE, label = label))
                  }
                  oopts <- options(mc.cores = workers)
                  on.exit(options(oopts))
                  future <- MulticoreFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, workers = workers, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  a <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    library("foreach")
                    {
                      plan <- future::plan()
                      stopifnot(inherits(plan, strategy2))
                      plan_a <- future::plan("list")
                      str(plan_a)
                      stopifnot(inherits(plan_a[[1]], strategy2))
                      message("foreach() - level 2 ...")
                      y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                        {
                          plan <- future::plan()
                          message(capture.output(print(plan)))
                          stopifnot(inherits(plan, "future"), inherits(plan, 
                            getOption("future.default", "sequential")))
                          plan_b <- future::plan("list")
                          str(plan_b)
                          stopifnot(inherits(plan_b[[1]], "future"), 
                            inherits(plan_b[[1]], getOption("future.default", 
                              "sequential")))
                          list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                        }
                      message("foreach() - level 2 ... DONE")
                      y
                    }
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, local = TRUE, earlySignal = FALSE, 
                    label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    local <- as.logical(local)
                    future <- SequentialFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, local = local, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, workers = availableCores(constraints = "multicore"), 
                    earlySignal = FALSE, label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(is.finite(workers), workers >= 
                      1L)
                    if (workers == 1L || !supportsMulticore()) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = lazy, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    oopts <- options(mc.cores = workers)
                    on.exit(options(oopts))
                    future <- MulticoreFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, workers = workers, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  foreach() - level 2 ...
  doFuture() ...
  - dummy globals (as locals): [1] 'b'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  The total size of the 3 globals is 41.91 KiB (42920 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'a', 'plan_a', '...future.x_ii'
  List of 3
   $ a             : int 1
   $ plan_a        :List of 1
    ..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, workers = availableCores(constraints = "multicore"), 
      earlySignal = FALSE, label = NULL, ...)  
    .. ..- attr(*, "class")= chr [1:4] "multicore" "multiprocess" "future" "function"
    .. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
    ..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ a             :<environment: a28cea8> 
    ..$ plan_a        :<environment: a28cea8> 
    ..$ ...future.x_ii:<environment: 9f29e50> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 42920
    - packages: [0] 
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 2
  Number of futures (= number of chunks): 2
  Launching 2 futures (chunks) ...
  Chunk #1 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 41.95 KiB (42956 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 0): <none>
  requestCore(): workers = 2
  MulticoreFuture started
  Chunk #1 of 2 ... DONE
  Chunk #2 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 41.98 KiB (42992 bytes)
  plan(): nbrOfWorkers() = 1
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 0): <none>
  requestCore(): workers = 2
  MulticoreFuture started
  Chunk #2 of 2 ... DONE
  Launching 2 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 2
  
   length: 1 (resolved future 1)
  plan(): nbrOfWorkers() = 1
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
   length: 0 (resolved future 2)
  resolve() on list ... DONE
  - collecting values of future
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 2 ... DONE
  foreach() - level 2 ...
  doFuture() ...
  - dummy globals (as locals): [1] 'b'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  The total size of the 3 globals is 41.91 KiB (42920 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'a', 'plan_a', '...future.x_ii'
  List of 3
   $ a             : int 2
   $ plan_a        :List of 1
    ..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, workers = availableCores(constraints = "multicore"), 
      earlySignal = FALSE, label = NULL, ...)  
    .. ..- attr(*, "class")= chr [1:4] "multicore" "multiprocess" "future" "function"
    .. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
    ..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ a             :<environment: 9c8c4e8> 
    ..$ plan_a        :<environment: 9c8c4e8> 
    ..$ ...future.x_ii:<environment: a25b5c8> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 42920
    - packages: [0] 
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 2
  Number of futures (= number of chunks): 2
  Launching 2 futures (chunks) ...
  Chunk #1 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 41.95 KiB (42956 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 0): <none>
  requestCore(): workers = 2
  MulticoreFuture started
  Chunk #1 of 2 ... DONE
  Chunk #2 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 41.98 KiB (42992 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 0): <none>
  plan(): nbrOfWorkers() = 1
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  requestCore(): workers = 2
  MulticoreFuture started
  Chunk #2 of 2 ... DONE
  Launching 2 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 2
  
   length: 1 (resolved future 1)
  plan(): nbrOfWorkers() = 1
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
   length: 0 (resolved future 2)
  resolve() on list ... DONE
  - collecting values of future
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 2 ... DONE
  SequentialFuture started (and completed)
  Chunk #1 of 1 ... DONE
  Launching 1 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 1
  
   length: 0 (resolved future 1)
  resolve() on list ... DONE
  - collecting values of future
  List of 1
   $ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, workers = availableCores(constraints = "multicore"), 
      earlySignal = FALSE, label = NULL, ...)  
    ..- attr(*, "class")= chr [1:4] "multicore" "multiprocess" "future" "function"
    ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    has_future <- requireNamespace("future", quietly = TRUE)
                    version <- if (has_future) 
                      packageVersion("future")
                    else NULL
                    if (!has_future || version < "1.8.0") {
                      info <- c(r_version = gsub("R version ", 
                        "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                        R.version$platform, 8 * .Machine$sizeof.pointer), 
                        os = paste(Sys.info()[c("sysname", "release", 
                          "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                      info <- sprintf("%s: %s", names(info), info)
                      info <- paste(info, collapse = "; ")
                      if (!has_future) {
                        msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                          info)
                      }
                      else {
                        msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                          info, version)
                      }
                      stop(msg)
                    }
                  }
                  ...future.mc.cores.old <- getOption("mc.cores")
                  options(mc.cores = 1L)
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  b <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    plan <- future::plan()
                    message(capture.output(print(plan)))
                    stopifnot(inherits(plan, "future"), inherits(plan, 
                      getOption("future.default", "sequential")))
                    plan_b <- future::plan("list")
                    str(plan_b)
                    stopifnot(inherits(plan_b[[1]], "future"), 
                      inherits(plan_b[[1]], getOption("future.default", 
                        "sequential")))
                    list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, workers = availableCores(constraints = "multicore"), 
                    earlySignal = FALSE, label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(is.finite(workers), workers >= 
                      1L)
                    if (workers == 1L || !supportsMulticore()) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = lazy, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    oopts <- options(mc.cores = workers)
                    on.exit(options(oopts))
                    future <- MulticoreFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, workers = workers, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    has_future <- requireNamespace("future", quietly = TRUE)
                    version <- if (has_future) 
                      packageVersion("future")
                    else NULL
                    if (!has_future || version < "1.8.0") {
                      info <- c(r_version = gsub("R version ", 
                        "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                        R.version$platform, 8 * .Machine$sizeof.pointer), 
                        os = paste(Sys.info()[c("sysname", "release", 
                          "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                      info <- sprintf("%s: %s", names(info), info)
                      info <- paste(info, collapse = "; ")
                      if (!has_future) {
                        msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                          info)
                      }
                      else {
                        msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                          info, version)
                      }
                      stop(msg)
                    }
                  }
                  ...future.mc.cores.old <- getOption("mc.cores")
                  options(mc.cores = 1L)
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  b <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    plan <- future::plan()
                    message(capture.output(print(plan)))
                    stopifnot(inherits(plan, "future"), inherits(plan, 
                      getOption("future.default", "sequential")))
                    plan_b <- future::plan("list")
                    str(plan_b)
                    stopifnot(inherits(plan_b[[1]], "future"), 
                      inherits(plan_b[[1]], getOption("future.default", 
                        "sequential")))
                    list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, workers = availableCores(constraints = "multicore"), 
                    earlySignal = FALSE, label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(is.finite(workers), workers >= 
                      1L)
                    if (workers == 1L || !supportsMulticore()) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = lazy, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    oopts <- options(mc.cores = workers)
                    on.exit(options(oopts))
                    future <- MulticoreFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, workers = workers, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, workers = availableCores(constraints = "multicore"), 
      earlySignal = FALSE, label = NULL, ...)  
    ..- attr(*, "class")= chr [1:4] "multicore" "multiprocess" "future" "function"
    ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    has_future <- requireNamespace("future", quietly = TRUE)
                    version <- if (has_future) 
                      packageVersion("future")
                    else NULL
                    if (!has_future || version < "1.8.0") {
                      info <- c(r_version = gsub("R version ", 
                        "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                        R.version$platform, 8 * .Machine$sizeof.pointer), 
                        os = paste(Sys.info()[c("sysname", "release", 
                          "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                      info <- sprintf("%s: %s", names(info), info)
                      info <- paste(info, collapse = "; ")
                      if (!has_future) {
                        msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                          info)
                      }
                      else {
                        msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                          info, version)
                      }
                      stop(msg)
                    }
                  }
                  ...future.mc.cores.old <- getOption("mc.cores")
                  options(mc.cores = 1L)
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  b <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    plan <- future::plan()
                    message(capture.output(print(plan)))
                    stopifnot(inherits(plan, "future"), inherits(plan, 
                      getOption("future.default", "sequential")))
                    plan_b <- future::plan("list")
                    str(plan_b)
                    stopifnot(inherits(plan_b[[1]], "future"), 
                      inherits(plan_b[[1]], getOption("future.default", 
                        "sequential")))
                    list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, workers = availableCores(constraints = "multicore"), 
                    earlySignal = FALSE, label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(is.finite(workers), workers >= 
                      1L)
                    if (workers == 1L || !supportsMulticore()) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = lazy, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    oopts <- options(mc.cores = workers)
                    on.exit(options(oopts))
                    future <- MulticoreFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, workers = workers, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    has_future <- requireNamespace("future", quietly = TRUE)
                    version <- if (has_future) 
                      packageVersion("future")
                    else NULL
                    if (!has_future || version < "1.8.0") {
                      info <- c(r_version = gsub("R version ", 
                        "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                        R.version$platform, 8 * .Machine$sizeof.pointer), 
                        os = paste(Sys.info()[c("sysname", "release", 
                          "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                      info <- sprintf("%s: %s", names(info), info)
                      info <- paste(info, collapse = "; ")
                      if (!has_future) {
                        msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                          info)
                      }
                      else {
                        msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                          info, version)
                      }
                      stop(msg)
                    }
                  }
                  ...future.mc.cores.old <- getOption("mc.cores")
                  options(mc.cores = 1L)
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  b <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    plan <- future::plan()
                    message(capture.output(print(plan)))
                    stopifnot(inherits(plan, "future"), inherits(plan, 
                      getOption("future.default", "sequential")))
                    plan_b <- future::plan("list")
                    str(plan_b)
                    stopifnot(inherits(plan_b[[1]], "future"), 
                      inherits(plan_b[[1]], getOption("future.default", 
                        "sequential")))
                    list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, workers = availableCores(constraints = "multicore"), 
                    earlySignal = FALSE, label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(is.finite(workers), workers >= 
                      1L)
                    if (workers == 1L || !supportsMulticore()) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = lazy, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    oopts <- options(mc.cores = workers)
                    on.exit(options(oopts))
                    future <- MulticoreFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, workers = workers, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 1 ... DONE
  - plan(list('sequential', 'multicore')) ... DONE
  - plan(list('sequential', 'multisession')) ...
  plan(): nbrOfWorkers() = 1
  foreach() - level 1 ...
  doFuture() ...
  - dummy globals (as locals): [1] 'a'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  The total size of the 3 globals is 124 bytes (124 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  List of 3
   $ bs            : int [1:3] 3 2 1
   $ strategy2     : chr "multisession"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ bs            :<environment: R_GlobalEnv> 
    ..$ strategy2     :<environment: R_GlobalEnv> 
    ..$ ...future.x_ii:<environment: 9c42dd8> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 124
    - packages: [1] 'foreach'
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 1
  Number of futures (= number of chunks): 1
  Launching 1 futures (chunks) ...
  Chunk #1 of 1 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 196 bytes (196 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 1): 'foreach'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    has_future <- requireNamespace("future", quietly = TRUE)
                    version <- if (has_future) 
                      packageVersion("future")
                    else NULL
                    if (!has_future || version < "1.8.0") {
                      info <- c(r_version = gsub("R version ", 
                        "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                        R.version$platform, 8 * .Machine$sizeof.pointer), 
                        os = paste(Sys.info()[c("sysname", "release", 
                          "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                      info <- sprintf("%s: %s", names(info), info)
                      info <- paste(info, collapse = "; ")
                      if (!has_future) {
                        msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                          info)
                      }
                      else {
                        msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                          info, version)
                      }
                      stop(msg)
                    }
                  }
                  local({
                    for (pkg in c("future", "foreach")) {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, persistent = FALSE, workers = availableCores(), 
                  gc = FALSE, earlySignal = FALSE, label = NULL, 
                  ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  if (is.function(workers)) 
                    workers <- workers()
                  workers <- as.integer(workers)
                  stop_if_not(length(workers) == 1, is.finite(workers), 
                    workers >= 1)
                  if (workers == 1L) {
                    return(sequential(expr, envir = envir, substitute = FALSE, 
                      lazy = TRUE, seed = seed, globals = globals, 
                      local = TRUE, label = label))
                  }
                  workers <- ClusterRegistry("start", workers = workers)
                  future <- MultisessionFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, persistent = persistent, 
                    workers = workers, gc = gc, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  a <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    library("foreach")
                    {
                      plan <- future::plan()
                      stopifnot(inherits(plan, strategy2))
                      plan_a <- future::plan("list")
                      str(plan_a)
                      stopifnot(inherits(plan_a[[1]], strategy2))
                      message("foreach() - level 2 ...")
                      y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                        {
                          plan <- future::plan()
                          message(capture.output(print(plan)))
                          stopifnot(inherits(plan, "future"), inherits(plan, 
                            getOption("future.default", "sequential")))
                          plan_b <- future::plan("list")
                          str(plan_b)
                          stopifnot(inherits(plan_b[[1]], "future"), 
                            inherits(plan_b[[1]], getOption("future.default", 
                              "sequential")))
                          list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                        }
                      message("foreach() - level 2 ... DONE")
                      y
                    }
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, local = TRUE, earlySignal = FALSE, 
                    label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    local <- as.logical(local)
                    future <- SequentialFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, local = local, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableCores(), 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(length(workers) == 1, is.finite(workers), 
                      workers >= 1)
                    if (workers == 1L) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = TRUE, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    workers <- ClusterRegistry("start", workers = workers)
                    future <- MultisessionFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  foreach() - level 2 ...
  doFuture() ...
  - dummy globals (as locals): [1] 'b'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  The total size of the 3 globals is 46.34 KiB (47456 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'a', 'plan_a', '...future.x_ii'
  List of 3
   $ a             : int 1
   $ plan_a        :List of 1
    ..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(), 
      gc = FALSE, earlySignal = FALSE, label = NULL, ...)  
    .. ..- attr(*, "class")= chr [1:5] "multisession" "cluster" "multiprocess" "future" ...
    .. ..- attr(*, "init")= logi TRUE
    .. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
    ..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ a             :<environment: 90d5d38> 
    ..$ plan_a        :<environment: 90d5d38> 
    ..$ ...future.x_ii:<environment: 8811698> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 47456
    - packages: [0] 
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 2
  Number of futures (= number of chunks): 2
  Launching 2 futures (chunks) ...
  Chunk #1 of 2 ...
  Workers: [n = 2] 'localhost', 'localhost'
  Base port: 11750
  Creating node 1 of 2 ...
  - setting up node
  Starting worker #1 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11750 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
  Waiting for worker #1 on 'localhost' to connect back
  Connection with worker #1 on 'localhost' established
  - assigning connection UUID
  - collecting session information
  Creating node 1 of 2 ... done
  Creating node 2 of 2 ...
  - setting up node
  Starting worker #2 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11750 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
  Waiting for worker #2 on 'localhost' to connect back
  Connection with worker #2 on 'localhost' established
  - assigning connection UUID
  - collecting session information
  Creating node 2 of 2 ... done
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 46.38 KiB (47492 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 0): <none>
  Exporting 3 global objects (46.38 KiB) to cluster node #1 ...
  Exporting 'a' (36 bytes) to cluster node #1 ...
  Exporting 'a' (36 bytes) to cluster node #1 ... DONE
  Exporting 'plan_a' (46.31 KiB) to cluster node #1 ...
  Exporting 'plan_a' (46.31 KiB) to cluster node #1 ... DONE
  Exporting '...future.x_ii' (36 bytes) to cluster node #1 ...
  Exporting '...future.x_ii' (36 bytes) to cluster node #1 ... DONE
  Exporting 3 global objects (46.38 KiB) to cluster node #1 ... DONE
  MultisessionFuture started
  Chunk #1 of 2 ... DONE
  Chunk #2 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 46.41 KiB (47528 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 0): <none>
  Exporting 3 global objects (46.41 KiB) to cluster node #2 ...
  Exporting 'a' (36 bytes) to cluster node #2 ...
  Exporting 'a' (36 bytes) to cluster node #2 ... DONE
  Exporting 'plan_a' (46.31 KiB) to cluster node #2 ...
  Exporting 'plan_a' (46.31 KiB) to cluster node #2 ... DONE
  Exporting '...future.x_ii' (72 bytes) to cluster node #2 ...
  Exporting '...future.x_ii' (72 bytes) to cluster node #2 ... DONE
  Exporting 3 global objects (46.41 KiB) to cluster node #2 ... DONE
  MultisessionFuture started
  Chunk #2 of 2 ... DONE
  Launching 2 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 2
  
   length: 1 (resolved future 1)
   length: 0 (resolved future 2)
  resolve() on list ... DONE
  - collecting values of future
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 2 ... DONE
  foreach() - level 2 ...
  doFuture() ...
  - dummy globals (as locals): [1] 'b'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  The total size of the 3 globals is 46.34 KiB (47456 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'a', 'plan_a', '...future.x_ii'
  List of 3
   $ a             : int 2
   $ plan_a        :List of 1
    ..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(), 
      gc = FALSE, earlySignal = FALSE, label = NULL, ...)  
    .. ..- attr(*, "class")= chr [1:5] "multisession" "cluster" "multiprocess" "future" ...
    .. ..- attr(*, "init")= logi TRUE
    .. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
    ..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ a             :<environment: 8e56440> 
    ..$ plan_a        :<environment: 8e56440> 
    ..$ ...future.x_ii:<environment: 9783210> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 47456
    - packages: [0] 
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 2
  Number of futures (= number of chunks): 2
  Launching 2 futures (chunks) ...
  Chunk #1 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 46.38 KiB (47492 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 0): <none>
  Exporting 3 global objects (46.38 KiB) to cluster node #1 ...
  Exporting 'a' (36 bytes) to cluster node #1 ...
  Exporting 'a' (36 bytes) to cluster node #1 ... DONE
  Exporting 'plan_a' (46.31 KiB) to cluster node #1 ...
  Exporting 'plan_a' (46.31 KiB) to cluster node #1 ... DONE
  Exporting '...future.x_ii' (36 bytes) to cluster node #1 ...
  Exporting '...future.x_ii' (36 bytes) to cluster node #1 ... DONE
  Exporting 3 global objects (46.38 KiB) to cluster node #1 ... DONE
  MultisessionFuture started
  Chunk #1 of 2 ... DONE
  Chunk #2 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 46.41 KiB (47528 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 0): <none>
  Exporting 3 global objects (46.41 KiB) to cluster node #2 ...
  Exporting 'a' (36 bytes) to cluster node #2 ...
  Exporting 'a' (36 bytes) to cluster node #2 ... DONE
  Exporting 'plan_a' (46.31 KiB) to cluster node #2 ...
  Exporting 'plan_a' (46.31 KiB) to cluster node #2 ... DONE
  Exporting '...future.x_ii' (72 bytes) to cluster node #2 ...
  Exporting '...future.x_ii' (72 bytes) to cluster node #2 ... DONE
  Exporting 3 global objects (46.41 KiB) to cluster node #2 ... DONE
  MultisessionFuture started
  Chunk #2 of 2 ... DONE
  Launching 2 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 2
  
   length: 1 (resolved future 1)
   length: 0 (resolved future 2)
  resolve() on list ... DONE
  - collecting values of future
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 2 ... DONE
  SequentialFuture started (and completed)
  Chunk #1 of 1 ... DONE
  Launching 1 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 1
  
   length: 0 (resolved future 1)
  resolve() on list ... DONE
  - collecting values of future
  List of 1
   $ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(), 
      gc = FALSE, earlySignal = FALSE, label = NULL, ...)  
    ..- attr(*, "class")= chr [1:5] "multisession" "cluster" "multiprocess" "future" ...
    ..- attr(*, "init")= logi TRUE
    ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    has_future <- requireNamespace("future", quietly = TRUE)
                    version <- if (has_future) 
                      packageVersion("future")
                    else NULL
                    if (!has_future || version < "1.8.0") {
                      info <- c(r_version = gsub("R version ", 
                        "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                        R.version$platform, 8 * .Machine$sizeof.pointer), 
                        os = paste(Sys.info()[c("sysname", "release", 
                          "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                      info <- sprintf("%s: %s", names(info), info)
                      info <- paste(info, collapse = "; ")
                      if (!has_future) {
                        msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                          info)
                      }
                      else {
                        msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                          info, version)
                      }
                      stop(msg)
                    }
                  }
                  ...future.mc.cores.old <- getOption("mc.cores")
                  options(mc.cores = 1L)
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  b <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    plan <- future::plan()
                    message(capture.output(print(plan)))
                    stopifnot(inherits(plan, "future"), inherits(plan, 
                      getOption("future.default", "sequential")))
                    plan_b <- future::plan("list")
                    str(plan_b)
                    stopifnot(inherits(plan_b[[1]], "future"), 
                      inherits(plan_b[[1]], getOption("future.default", 
                        "sequential")))
                    list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableCores(), 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(length(workers) == 1, is.finite(workers), 
                      workers >= 1)
                    if (workers == 1L) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = TRUE, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    workers <- ClusterRegistry("start", workers = workers)
                    future <- MultisessionFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    has_future <- requireNamespace("future", quietly = TRUE)
                    version <- if (has_future) 
                      packageVersion("future")
                    else NULL
                    if (!has_future || version < "1.8.0") {
                      info <- c(r_version = gsub("R version ", 
                        "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                        R.version$platform, 8 * .Machine$sizeof.pointer), 
                        os = paste(Sys.info()[c("sysname", "release", 
                          "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                      info <- sprintf("%s: %s", names(info), info)
                      info <- paste(info, collapse = "; ")
                      if (!has_future) {
                        msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                          info)
                      }
                      else {
                        msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                          info, version)
                      }
                      stop(msg)
                    }
                  }
                  ...future.mc.cores.old <- getOption("mc.cores")
                  options(mc.cores = 1L)
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  b <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    plan <- future::plan()
                    message(capture.output(print(plan)))
                    stopifnot(inherits(plan, "future"), inherits(plan, 
                      getOption("future.default", "sequential")))
                    plan_b <- future::plan("list")
                    str(plan_b)
                    stopifnot(inherits(plan_b[[1]], "future"), 
                      inherits(plan_b[[1]], getOption("future.default", 
                        "sequential")))
                    list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableCores(), 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(length(workers) == 1, is.finite(workers), 
                      workers >= 1)
                    if (workers == 1L) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = TRUE, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    workers <- ClusterRegistry("start", workers = workers)
                    future <- MultisessionFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(), 
      gc = FALSE, earlySignal = FALSE, label = NULL, ...)  
    ..- attr(*, "class")= chr [1:5] "multisession" "cluster" "multiprocess" "future" ...
    ..- attr(*, "init")= logi TRUE
    ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    has_future <- requireNamespace("future", quietly = TRUE)
                    version <- if (has_future) 
                      packageVersion("future")
                    else NULL
                    if (!has_future || version < "1.8.0") {
                      info <- c(r_version = gsub("R version ", 
                        "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                        R.version$platform, 8 * .Machine$sizeof.pointer), 
                        os = paste(Sys.info()[c("sysname", "release", 
                          "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                      info <- sprintf("%s: %s", names(info), info)
                      info <- paste(info, collapse = "; ")
                      if (!has_future) {
                        msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                          info)
                      }
                      else {
                        msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                          info, version)
                      }
                      stop(msg)
                    }
                  }
                  ...future.mc.cores.old <- getOption("mc.cores")
                  options(mc.cores = 1L)
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  b <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    plan <- future::plan()
                    message(capture.output(print(plan)))
                    stopifnot(inherits(plan, "future"), inherits(plan, 
                      getOption("future.default", "sequential")))
                    plan_b <- future::plan("list")
                    str(plan_b)
                    stopifnot(inherits(plan_b[[1]], "future"), 
                      inherits(plan_b[[1]], getOption("future.default", 
                        "sequential")))
                    list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableCores(), 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(length(workers) == 1, is.finite(workers), 
                      workers >= 1)
                    if (workers == 1L) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = TRUE, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    workers <- ClusterRegistry("start", workers = workers)
                    future <- MultisessionFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    has_future <- requireNamespace("future", quietly = TRUE)
                    version <- if (has_future) 
                      packageVersion("future")
                    else NULL
                    if (!has_future || version < "1.8.0") {
                      info <- c(r_version = gsub("R version ", 
                        "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                        R.version$platform, 8 * .Machine$sizeof.pointer), 
                        os = paste(Sys.info()[c("sysname", "release", 
                          "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                      info <- sprintf("%s: %s", names(info), info)
                      info <- paste(info, collapse = "; ")
                      if (!has_future) {
                        msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                          info)
                      }
                      else {
                        msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                          info, version)
                      }
                      stop(msg)
                    }
                  }
                  ...future.mc.cores.old <- getOption("mc.cores")
                  options(mc.cores = 1L)
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  b <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    plan <- future::plan()
                    message(capture.output(print(plan)))
                    stopifnot(inherits(plan, "future"), inherits(plan, 
                      getOption("future.default", "sequential")))
                    plan_b <- future::plan("list")
                    str(plan_b)
                    stopifnot(inherits(plan_b[[1]], "future"), 
                      inherits(plan_b[[1]], getOption("future.default", 
                        "sequential")))
                    list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableCores(), 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(length(workers) == 1, is.finite(workers), 
                      workers >= 1)
                    if (workers == 1L) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = TRUE, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    workers <- ClusterRegistry("start", workers = workers)
                    future <- MultisessionFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 1 ... DONE
  - plan(list('sequential', 'multisession')) ... DONE
  - plan(list('sequential', 'cluster')) ...
  plan(): nbrOfWorkers() = 1
  foreach() - level 1 ...
  doFuture() ...
  - dummy globals (as locals): [1] 'a'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  The total size of the 3 globals is 116 bytes (116 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  List of 3
   $ bs            : int [1:3] 3 2 1
   $ strategy2     : chr "cluster"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ bs            :<environment: R_GlobalEnv> 
    ..$ strategy2     :<environment: R_GlobalEnv> 
    ..$ ...future.x_ii:<environment: 9495118> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 116
    - packages: [1] 'foreach'
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 1
  Number of futures (= number of chunks): 1
  Launching 1 futures (chunks) ...
  Chunk #1 of 1 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 188 bytes (188 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 1): 'foreach'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    has_future <- requireNamespace("future", quietly = TRUE)
                    version <- if (has_future) 
                      packageVersion("future")
                    else NULL
                    if (!has_future || version < "1.8.0") {
                      info <- c(r_version = gsub("R version ", 
                        "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                        R.version$platform, 8 * .Machine$sizeof.pointer), 
                        os = paste(Sys.info()[c("sysname", "release", 
                          "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                      info <- sprintf("%s: %s", names(info), info)
                      info <- paste(info, collapse = "; ")
                      if (!has_future) {
                        msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                          info)
                      }
                      else {
                        msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                          info, version)
                      }
                      stop(msg)
                    }
                  }
                  local({
                    for (pkg in c("future", "foreach")) {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
                  user = NULL, revtunnel = TRUE, homogeneous = TRUE, 
                  gc = FALSE, earlySignal = FALSE, label = NULL, 
                  ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  future <- ClusterFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, persistent = persistent, 
                    workers = workers, user = user, revtunnel = revtunnel, 
                    homogeneous = homogeneous, gc = gc, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  a <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    library("foreach")
                    {
                      plan <- future::plan()
                      stopifnot(inherits(plan, strategy2))
                      plan_a <- future::plan("list")
                      str(plan_a)
                      stopifnot(inherits(plan_a[[1]], strategy2))
                      message("foreach() - level 2 ...")
                      y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                        {
                          plan <- future::plan()
                          message(capture.output(print(plan)))
                          stopifnot(inherits(plan, "future"), inherits(plan, 
                            getOption("future.default", "sequential")))
                          plan_b <- future::plan("list")
                          str(plan_b)
                          stopifnot(inherits(plan_b[[1]], "future"), 
                            inherits(plan_b[[1]], getOption("future.default", 
                              "sequential")))
                          list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                        }
                      message("foreach() - level 2 ... DONE")
                      y
                    }
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, local = TRUE, earlySignal = FALSE, 
                    label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    local <- as.logical(local)
                    future <- SequentialFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, local = local, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
                    user = NULL, revtunnel = TRUE, homogeneous = TRUE, 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    future <- ClusterFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, user = user, revtunnel = revtunnel, 
                      homogeneous = homogeneous, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  foreach() - level 2 ...
  doFuture() ...
  - dummy globals (as locals): [1] 'b'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  The total size of the 3 globals is 36.93 KiB (37820 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'a', 'plan_a', '...future.x_ii'
  List of 3
   $ a             : int 1
   $ plan_a        :List of 1
    ..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
      user = NULL, revtunnel = TRUE, homogeneous = TRUE, gc = FALSE, earlySignal = FALSE, 
      label = NULL, ...)  
    .. ..- attr(*, "class")= chr [1:4] "cluster" "multiprocess" "future" "function"
    .. ..- attr(*, "init")= logi TRUE
    .. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
    ..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ a             :<environment: 9bbeff8> 
    ..$ plan_a        :<environment: 9bbeff8> 
    ..$ ...future.x_ii:<environment: a17b8c0> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 37820
    - packages: [0] 
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 2
  Number of futures (= number of chunks): 2
  Launching 2 futures (chunks) ...
  Chunk #1 of 2 ...
  Workers: [n = 2] 'localhost', 'localhost'
  Base port: 11924
  Creating node 1 of 2 ...
  - setting up node
  Starting worker #1 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11924 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
  Waiting for worker #1 on 'localhost' to connect back
  Connection with worker #1 on 'localhost' established
  - assigning connection UUID
  - collecting session information
  Creating node 1 of 2 ... done
  Creating node 2 of 2 ...
  - setting up node
  Starting worker #2 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11924 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
  Waiting for worker #2 on 'localhost' to connect back
  Connection with worker #2 on 'localhost' established
  - assigning connection UUID
  - collecting session information
  Creating node 2 of 2 ... done
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 36.97 KiB (37856 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 0): <none>
  Exporting 3 global objects (36.97 KiB) to cluster node #1 ...
  Exporting 'a' (36 bytes) to cluster node #1 ...
  Exporting 'a' (36 bytes) to cluster node #1 ... DONE
  Exporting 'plan_a' (36.90 KiB) to cluster node #1 ...
  Exporting 'plan_a' (36.90 KiB) to cluster node #1 ... DONE
  Exporting '...future.x_ii' (36 bytes) to cluster node #1 ...
  Exporting '...future.x_ii' (36 bytes) to cluster node #1 ... DONE
  Exporting 3 global objects (36.97 KiB) to cluster node #1 ... DONE
  ClusterFuture started
  Chunk #1 of 2 ... DONE
  Chunk #2 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 37.00 KiB (37892 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 0): <none>
  Exporting 3 global objects (37.00 KiB) to cluster node #2 ...
  Exporting 'a' (36 bytes) to cluster node #2 ...
  Exporting 'a' (36 bytes) to cluster node #2 ... DONE
  Exporting 'plan_a' (36.90 KiB) to cluster node #2 ...
  Exporting 'plan_a' (36.90 KiB) to cluster node #2 ... DONE
  Exporting '...future.x_ii' (72 bytes) to cluster node #2 ...
  Exporting '...future.x_ii' (72 bytes) to cluster node #2 ... DONE
  Exporting 3 global objects (37.00 KiB) to cluster node #2 ... DONE
  ClusterFuture started
  Chunk #2 of 2 ... DONE
  Launching 2 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 2
  
   length: 1 (resolved future 1)
   length: 0 (resolved future 2)
  resolve() on list ... DONE
  - collecting values of future
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 2 ... DONE
  foreach() - level 2 ...
  doFuture() ...
  - dummy globals (as locals): [1] 'b'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  The total size of the 3 globals is 36.93 KiB (37820 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'a', 'plan_a', '...future.x_ii'
  List of 3
   $ a             : int 2
   $ plan_a        :List of 1
    ..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
      user = NULL, revtunnel = TRUE, homogeneous = TRUE, gc = FALSE, earlySignal = FALSE, 
      label = NULL, ...)  
    .. ..- attr(*, "class")= chr [1:4] "cluster" "multiprocess" "future" "function"
    .. ..- attr(*, "init")= logi TRUE
    .. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
    ..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ a             :<environment: 9c71918> 
    ..$ plan_a        :<environment: 9c71918> 
    ..$ ...future.x_ii:<environment: a269750> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 37820
    - packages: [0] 
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 2
  Number of futures (= number of chunks): 2
  Launching 2 futures (chunks) ...
  Chunk #1 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 36.97 KiB (37856 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 0): <none>
  Exporting 3 global objects (36.97 KiB) to cluster node #1 ...
  Exporting 'a' (36 bytes) to cluster node #1 ...
  Exporting 'a' (36 bytes) to cluster node #1 ... DONE
  Exporting 'plan_a' (36.90 KiB) to cluster node #1 ...
  Exporting 'plan_a' (36.90 KiB) to cluster node #1 ... DONE
  Exporting '...future.x_ii' (36 bytes) to cluster node #1 ...
  Exporting '...future.x_ii' (36 bytes) to cluster node #1 ... DONE
  Exporting 3 global objects (36.97 KiB) to cluster node #1 ... DONE
  ClusterFuture started
  Chunk #1 of 2 ... DONE
  Chunk #2 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 37.00 KiB (37892 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 0): <none>
  Exporting 3 global objects (37.00 KiB) to cluster node #2 ...
  Exporting 'a' (36 bytes) to cluster node #2 ...
  Exporting 'a' (36 bytes) to cluster node #2 ... DONE
  Exporting 'plan_a' (36.90 KiB) to cluster node #2 ...
  Exporting 'plan_a' (36.90 KiB) to cluster node #2 ... DONE
  Exporting '...future.x_ii' (72 bytes) to cluster node #2 ...
  Exporting '...future.x_ii' (72 bytes) to cluster node #2 ... DONE
  Exporting 3 global objects (37.00 KiB) to cluster node #2 ... DONE
  ClusterFuture started
  Chunk #2 of 2 ... DONE
  Launching 2 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 2
  
   length: 1 (resolved future 1)
   length: 0 (resolved future 2)
  resolve() on list ... DONE
  - collecting values of future
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 2 ... DONE
  SequentialFuture started (and completed)
  Chunk #1 of 1 ... DONE
  Launching 1 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 1
  
   length: 0 (resolved future 1)
  resolve() on list ... DONE
  - collecting values of future
  List of 1
   $ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
      user = NULL, revtunnel = TRUE, homogeneous = TRUE, gc = FALSE, earlySignal = FALSE, 
      label = NULL, ...)  
    ..- attr(*, "class")= chr [1:4] "cluster" "multiprocess" "future" "function"
    ..- attr(*, "init")= logi TRUE
    ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  has_future <- requireNamespace("future", quietly = TRUE)
                  version <- if (has_future) 
                    packageVersion("future")
                  else NULL
                  if (!has_future || version < "1.8.0") {
                    info <- c(r_version = gsub("R version ", "", 
                      R.version$version.string), platform = sprintf("%s (%s-bit)", 
                      R.version$platform, 8 * .Machine$sizeof.pointer), 
                      os = paste(Sys.info()[c("sysname", "release", 
                        "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                    info <- sprintf("%s: %s", names(info), info)
                    info <- paste(info, collapse = "; ")
                    if (!has_future) {
                      msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                        info)
                    }
                    else {
                      msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                        info, version)
                    }
                    stop(msg)
                  }
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  b <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    plan <- future::plan()
                    message(capture.output(print(plan)))
                    stopifnot(inherits(plan, "future"), inherits(plan, 
                      getOption("future.default", "sequential")))
                    plan_b <- future::plan("list")
                    str(plan_b)
                    stopifnot(inherits(plan_b[[1]], "future"), 
                      inherits(plan_b[[1]], getOption("future.default", 
                        "sequential")))
                    list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
                    user = NULL, revtunnel = TRUE, homogeneous = TRUE, 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    future <- ClusterFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, user = user, revtunnel = revtunnel, 
                      homogeneous = homogeneous, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  has_future <- requireNamespace("future", quietly = TRUE)
                  version <- if (has_future) 
                    packageVersion("future")
                  else NULL
                  if (!has_future || version < "1.8.0") {
                    info <- c(r_version = gsub("R version ", "", 
                      R.version$version.string), platform = sprintf("%s (%s-bit)", 
                      R.version$platform, 8 * .Machine$sizeof.pointer), 
                      os = paste(Sys.info()[c("sysname", "release", 
                        "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                    info <- sprintf("%s: %s", names(info), info)
                    info <- paste(info, collapse = "; ")
                    if (!has_future) {
                      msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                        info)
                    }
                    else {
                      msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                        info, version)
                    }
                    stop(msg)
                  }
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  b <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    plan <- future::plan()
                    message(capture.output(print(plan)))
                    stopifnot(inherits(plan, "future"), inherits(plan, 
                      getOption("future.default", "sequential")))
                    plan_b <- future::plan("list")
                    str(plan_b)
                    stopifnot(inherits(plan_b[[1]], "future"), 
                      inherits(plan_b[[1]], getOption("future.default", 
                        "sequential")))
                    list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
                    user = NULL, revtunnel = TRUE, homogeneous = TRUE, 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    future <- ClusterFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, user = user, revtunnel = revtunnel, 
                      homogeneous = homogeneous, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
      user = NULL, revtunnel = TRUE, homogeneous = TRUE, gc = FALSE, earlySignal = FALSE, 
      label = NULL, ...)  
    ..- attr(*, "class")= chr [1:4] "cluster" "multiprocess" "future" "function"
    ..- attr(*, "init")= logi TRUE
    ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  has_future <- requireNamespace("future", quietly = TRUE)
                  version <- if (has_future) 
                    packageVersion("future")
                  else NULL
                  if (!has_future || version < "1.8.0") {
                    info <- c(r_version = gsub("R version ", "", 
                      R.version$version.string), platform = sprintf("%s (%s-bit)", 
                      R.version$platform, 8 * .Machine$sizeof.pointer), 
                      os = paste(Sys.info()[c("sysname", "release", 
                        "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                    info <- sprintf("%s: %s", names(info), info)
                    info <- paste(info, collapse = "; ")
                    if (!has_future) {
                      msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                        info)
                    }
                    else {
                      msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                        info, version)
                    }
                    stop(msg)
                  }
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  b <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    plan <- future::plan()
                    message(capture.output(print(plan)))
                    stopifnot(inherits(plan, "future"), inherits(plan, 
                      getOption("future.default", "sequential")))
                    plan_b <- future::plan("list")
                    str(plan_b)
                    stopifnot(inherits(plan_b[[1]], "future"), 
                      inherits(plan_b[[1]], getOption("future.default", 
                        "sequential")))
                    list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
                    user = NULL, revtunnel = TRUE, homogeneous = TRUE, 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    future <- ClusterFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, user = user, revtunnel = revtunnel, 
                      homogeneous = homogeneous, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  has_future <- requireNamespace("future", quietly = TRUE)
                  version <- if (has_future) 
                    packageVersion("future")
                  else NULL
                  if (!has_future || version < "1.8.0") {
                    info <- c(r_version = gsub("R version ", "", 
                      R.version$version.string), platform = sprintf("%s (%s-bit)", 
                      R.version$platform, 8 * .Machine$sizeof.pointer), 
                      os = paste(Sys.info()[c("sysname", "release", 
                        "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                    info <- sprintf("%s: %s", names(info), info)
                    info <- paste(info, collapse = "; ")
                    if (!has_future) {
                      msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                        info)
                    }
                    else {
                      msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                        info, version)
                    }
                    stop(msg)
                  }
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  b <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    plan <- future::plan()
                    message(capture.output(print(plan)))
                    stopifnot(inherits(plan, "future"), inherits(plan, 
                      getOption("future.default", "sequential")))
                    plan_b <- future::plan("list")
                    str(plan_b)
                    stopifnot(inherits(plan_b[[1]], "future"), 
                      inherits(plan_b[[1]], getOption("future.default", 
                        "sequential")))
                    list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
                    user = NULL, revtunnel = TRUE, homogeneous = TRUE, 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    future <- ClusterFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, user = user, revtunnel = revtunnel, 
                      homogeneous = homogeneous, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 1 ... DONE
  - plan(list('sequential', 'cluster')) ... DONE
  - plan(list('multicore', 'sequential')) ...
  plan(): nbrOfWorkers() = 2
  foreach() - level 1 ...
  doFuture() ...
  - dummy globals (as locals): [1] 'a'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  The total size of the 3 globals is 124 bytes (124 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  List of 3
   $ bs            : int [1:3] 3 2 1
   $ strategy2     : chr "sequential"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ bs            :<environment: R_GlobalEnv> 
    ..$ strategy2     :<environment: R_GlobalEnv> 
    ..$ ...future.x_ii:<environment: a3c1700> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 124
    - packages: [1] 'foreach'
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 2
  Number of futures (= number of chunks): 2
  Launching 2 futures (chunks) ...
  Chunk #1 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 160 bytes (160 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 1): 'foreach'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    {
                      has_future <- requireNamespace("future", 
                        quietly = TRUE)
                      version <- if (has_future) 
                        packageVersion("future")
                      else NULL
                      if (!has_future || version < "1.8.0") {
                        info <- c(r_version = gsub("R version ", 
                          "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                          R.version$platform, 8 * .Machine$sizeof.pointer), 
                          os = paste(Sys.info()[c("sysname", "release", 
                            "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                        info <- sprintf("%s: %s", names(info), 
                          info)
                        info <- paste(info, collapse = "; ")
                        if (!has_future) {
                          msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                            info)
                        }
                        else {
                          msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                            info, version)
                        }
                        stop(msg)
                      }
                    }
                    ...future.mc.cores.old <- getOption("mc.cores")
                    options(mc.cores = 1L)
                  }
                  local({
                    for (pkg in c("future", "foreach")) {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, local = TRUE, earlySignal = FALSE, 
                  label = NULL, ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  local <- as.logical(local)
                  future <- SequentialFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, local = local, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  a <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    library("foreach")
                    {
                      plan <- future::plan()
                      stopifnot(inherits(plan, strategy2))
                      plan_a <- future::plan("list")
                      str(plan_a)
                      stopifnot(inherits(plan_a[[1]], strategy2))
                      message("foreach() - level 2 ...")
                      y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                        {
                          plan <- future::plan()
                          message(capture.output(print(plan)))
                          stopifnot(inherits(plan, "future"), inherits(plan, 
                            getOption("future.default", "sequential")))
                          plan_b <- future::plan("list")
                          str(plan_b)
                          stopifnot(inherits(plan_b[[1]], "future"), 
                            inherits(plan_b[[1]], getOption("future.default", 
                              "sequential")))
                          list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                        }
                      message("foreach() - level 2 ... DONE")
                      y
                    }
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, workers = availableCores(constraints = "multicore"), 
                    earlySignal = FALSE, label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(is.finite(workers), workers >= 
                      1L)
                    if (workers == 1L || !supportsMulticore()) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = lazy, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    oopts <- options(mc.cores = workers)
                    on.exit(options(oopts))
                    future <- MulticoreFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, workers = workers, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, local = TRUE, earlySignal = FALSE, 
                    label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    local <- as.logical(local)
                    future <- SequentialFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, local = local, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  requestCore(): workers = 2
  MulticoreFuture started
  Chunk #1 of 2 ... DONE
  Chunk #2 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 160 bytes (160 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 1): 'foreach'
  foreach() - level 2 ...
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    {
                      has_future <- requireNamespace("future", 
                        quietly = TRUE)
                      version <- if (has_future) 
                        packageVersion("future")
                      else NULL
                      if (!has_future || version < "1.8.0") {
                        info <- c(r_version = gsub("R version ", 
                          "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                          R.version$platform, 8 * .Machine$sizeof.pointer), 
                          os = paste(Sys.info()[c("sysname", "release", 
                            "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                        info <- sprintf("%s: %s", names(info), 
                          info)
                        info <- paste(info, collapse = "; ")
                        if (!has_future) {
                          msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                            info)
                        }
                        else {
                          msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                            info, version)
                        }
                        stop(msg)
                      }
                    }
                    ...future.mc.cores.old <- getOption("mc.cores")
                    options(mc.cores = 1L)
                  }
                  local({
                    for (pkg in c("future", "foreach")) {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, local = TRUE, earlySignal = FALSE, 
                  label = NULL, ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  local <- as.logical(local)
                  future <- SequentialFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, local = local, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  a <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    library("foreach")
                    {
                      plan <- future::plan()
                      stopifnot(inherits(plan, strategy2))
                      plan_a <- future::plan("list")
                      str(plan_a)
                      stopifnot(inherits(plan_a[[1]], strategy2))
                      message("foreach() - level 2 ...")
                      y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                        {
                          plan <- future::plan()
                          message(capture.output(print(plan)))
                          stopifnot(inherits(plan, "future"), inherits(plan, 
                            getOption("future.default", "sequential")))
                          plan_b <- future::plan("list")
                          str(plan_b)
                          stopifnot(inherits(plan_b[[1]], "future"), 
                            inherits(plan_b[[1]], getOption("future.default", 
                              "sequential")))
                          list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                        }
                      message("foreach() - level 2 ... DONE")
                      y
                    }
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, workers = availableCores(constraints = "multicore"), 
                    earlySignal = FALSE, label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(is.finite(workers), workers >= 
                      1L)
                    if (workers == 1L || !supportsMulticore()) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = lazy, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    oopts <- options(mc.cores = workers)
                    on.exit(options(oopts))
                    future <- MulticoreFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, workers = workers, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, local = TRUE, earlySignal = FALSE, 
                    label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    local <- as.logical(local)
                    future <- SequentialFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, local = local, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  requestCore(): workers = 2
  - dummy globals (as locals): [1] 'b'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  MulticoreFuture started
  Chunk #2 of 2 ... DONE
  Launching 2 futures (chunks) ... DONE
  The total size of the 3 globals is 22.75 KiB (23300 bytes)
  - resolving future
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  resolve() on list ...
  
   recursive: 0
  getGlobalsAndPackages() ... DONE
   length: 2
  
    - globals: [3] 'a', 'plan_a', '...future.x_ii'
  foreach() - level 2 ...
  List of 3
   $ a             : int 1
   $ plan_a        :List of 1
    ..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    .. ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    .. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
    ..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ a             :<environment: 8f94328> 
    ..$ plan_a        :<environment: 8f94328> 
    ..$ ...future.x_ii:<environment: 94f3d60> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 23300
    - packages: [0] 
  doFuture() ...
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 1
  Number of futures (= number of chunks): 1
  Launching 1 futures (chunks) ...
  - dummy globals (as locals): [1] 'b'
  Chunk #1 of 1 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
  - R expression:
  Resolving globals: FALSE
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  The total size of the 3 globals is 22.86 KiB (23408 bytes)
  getGlobalsAndPackages() ...
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  Retrieving globals ...
  getGlobalsAndPackages() ... DONE
  - globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 0): <none>
  The total size of the 3 globals is 22.75 KiB (23300 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'a', 'plan_a', '...future.x_ii'
  List of 3
   $ a             : int 2
   $ plan_a        :List of 1
    ..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    .. ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    .. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
    ..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ a             :<environment: 9536498> 
    ..$ plan_a        :<environment: 9536498> 
    ..$ ...future.x_ii:<environment: 9bd06c8> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 23300
    - packages: [0] 
    - R expression:
  plan(): nbrOfWorkers() = 1
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  Number of chunks: 1
  Number of futures (= number of chunks): 1
  Launching 1 futures (chunks) ...
  Chunk #1 of 1 ...
  getGlobalsAndPackages() ...
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  - globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 22.86 KiB (23408 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  SequentialFuture started (and completed)
  Chunk #1 of 1 ... DONE
  Launching 1 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 1
  
   length: 0 (resolved future 1)
  Packages needed by future strategies (n = 0): <none>
  resolve() on list ... DONE
  - collecting values of future
  Packages needed by the future expression (n = 0): <none>
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 2 ... DONE
   length: 1 (resolved future 1)
  plan(): nbrOfWorkers() = 1
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  SequentialFuture started (and completed)
  Chunk #1 of 1 ... DONE
  Launching 1 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 1
  
   length: 0 (resolved future 1)
  resolve() on list ... DONE
  - collecting values of future
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 2 ... DONE
   length: 0 (resolved future 2)
  resolve() on list ... DONE
  - collecting values of future
  List of 1
   $ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  has_future <- requireNamespace("future", quietly = TRUE)
                  version <- if (has_future) 
                    packageVersion("future")
                  else NULL
                  if (!has_future || version < "1.8.0") {
                    info <- c(r_version = gsub("R version ", "", 
                      R.version$version.string), platform = sprintf("%s (%s-bit)", 
                      R.version$platform, 8 * .Machine$sizeof.pointer), 
                      os = paste(Sys.info()[c("sysname", "release", 
                        "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                    info <- sprintf("%s: %s", names(info), info)
                    info <- paste(info, collapse = "; ")
                    if (!has_future) {
                      msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                        info)
                    }
                    else {
                      msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                        info, version)
                    }
                    stop(msg)
                  }
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  b <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    plan <- future::plan()
                    message(capture.output(print(plan)))
                    stopifnot(inherits(plan, "future"), inherits(plan, 
                      getOption("future.default", "sequential")))
                    plan_b <- future::plan("list")
                    str(plan_b)
                    stopifnot(inherits(plan_b[[1]], "future"), 
                      inherits(plan_b[[1]], getOption("future.default", 
                        "sequential")))
                    list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, local = TRUE, earlySignal = FALSE, 
                    label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    local <- as.logical(local)
                    future <- SequentialFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, local = local, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  has_future <- requireNamespace("future", quietly = TRUE)
                  version <- if (has_future) 
                    packageVersion("future")
                  else NULL
                  if (!has_future || version < "1.8.0") {
                    info <- c(r_version = gsub("R version ", "", 
                      R.version$version.string), platform = sprintf("%s (%s-bit)", 
                      R.version$platform, 8 * .Machine$sizeof.pointer), 
                      os = paste(Sys.info()[c("sysname", "release", 
                        "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                    info <- sprintf("%s: %s", names(info), info)
                    info <- paste(info, collapse = "; ")
                    if (!has_future) {
                      msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                        info)
                    }
                    else {
                      msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                        info, version)
                    }
                    stop(msg)
                  }
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  b <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    plan <- future::plan()
                    message(capture.output(print(plan)))
                    stopifnot(inherits(plan, "future"), inherits(plan, 
                      getOption("future.default", "sequential")))
                    plan_b <- future::plan("list")
                    str(plan_b)
                    stopifnot(inherits(plan_b[[1]], "future"), 
                      inherits(plan_b[[1]], getOption("future.default", 
                        "sequential")))
                    list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, local = TRUE, earlySignal = FALSE, 
                    label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    local <- as.logical(local)
                    future <- SequentialFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, local = local, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 1 ... DONE
  - plan(list('multicore', 'sequential')) ... DONE
  - plan(list('multicore', 'multicore')) ...
  plan(): nbrOfWorkers() = 2
  foreach() - level 1 ...
  doFuture() ...
  - dummy globals (as locals): [1] 'a'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  The total size of the 3 globals is 124 bytes (124 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  List of 3
   $ bs            : int [1:3] 3 2 1
   $ strategy2     : chr "multicore"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ bs            :<environment: R_GlobalEnv> 
    ..$ strategy2     :<environment: R_GlobalEnv> 
    ..$ ...future.x_ii:<environment: 9ce4e28> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 124
    - packages: [1] 'foreach'
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 2
  Number of futures (= number of chunks): 2
  Launching 2 futures (chunks) ...
  Chunk #1 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 160 bytes (160 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 1): 'foreach'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    {
                      has_future <- requireNamespace("future", 
                        quietly = TRUE)
                      version <- if (has_future) 
                        packageVersion("future")
                      else NULL
                      if (!has_future || version < "1.8.0") {
                        info <- c(r_version = gsub("R version ", 
                          "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                          R.version$platform, 8 * .Machine$sizeof.pointer), 
                          os = paste(Sys.info()[c("sysname", "release", 
                            "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                        info <- sprintf("%s: %s", names(info), 
                          info)
                        info <- paste(info, collapse = "; ")
                        if (!has_future) {
                          msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                            info)
                        }
                        else {
                          msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                            info, version)
                        }
                        stop(msg)
                      }
                    }
                    ...future.mc.cores.old <- getOption("mc.cores")
                    options(mc.cores = 1L)
                  }
                  local({
                    for (pkg in c("future", "foreach")) {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, workers = availableCores(constraints = "multicore"), 
                  earlySignal = FALSE, label = NULL, ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  if (is.function(workers)) 
                    workers <- workers()
                  workers <- as.integer(workers)
                  stop_if_not(is.finite(workers), workers >= 1L)
                  if (workers == 1L || !supportsMulticore()) {
                    return(sequential(expr, envir = envir, substitute = FALSE, 
                      lazy = lazy, seed = seed, globals = globals, 
                      local = TRUE, label = label))
                  }
                  oopts <- options(mc.cores = workers)
                  on.exit(options(oopts))
                  future <- MulticoreFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, workers = workers, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  a <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    library("foreach")
                    {
                      plan <- future::plan()
                      stopifnot(inherits(plan, strategy2))
                      plan_a <- future::plan("list")
                      str(plan_a)
                      stopifnot(inherits(plan_a[[1]], strategy2))
                      message("foreach() - level 2 ...")
                      y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                        {
                          plan <- future::plan()
                          message(capture.output(print(plan)))
                          stopifnot(inherits(plan, "future"), inherits(plan, 
                            getOption("future.default", "sequential")))
                          plan_b <- future::plan("list")
                          str(plan_b)
                          stopifnot(inherits(plan_b[[1]], "future"), 
                            inherits(plan_b[[1]], getOption("future.default", 
                              "sequential")))
                          list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                        }
                      message("foreach() - level 2 ... DONE")
                      y
                    }
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, workers = availableCores(constraints = "multicore"), 
                    earlySignal = FALSE, label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(is.finite(workers), workers >= 
                      1L)
                    if (workers == 1L || !supportsMulticore()) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = lazy, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    oopts <- options(mc.cores = workers)
                    on.exit(options(oopts))
                    future <- MulticoreFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, workers = workers, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, workers = availableCores(constraints = "multicore"), 
                    earlySignal = FALSE, label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(is.finite(workers), workers >= 
                      1L)
                    if (workers == 1L || !supportsMulticore()) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = lazy, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    oopts <- options(mc.cores = workers)
                    on.exit(options(oopts))
                    future <- MulticoreFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, workers = workers, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  requestCore(): workers = 2
  MulticoreFuture started
  Chunk #1 of 2 ... DONE
  Chunk #2 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 160 bytes (160 bytes)
  foreach() - level 2 ...
  doFuture() ...
  - dummy globals (as locals): [1] 'b'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
  Retrieving globals ... DONE
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  Resolving globals: FALSE
  
  getGlobalsAndPackages() ... DONE
  The total size of the 3 globals is 41.91 KiB (42920 bytes)
  Packages needed by the future expression (n = 1): 'foreach'
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'a', 'plan_a', '...future.x_ii'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    {
                      has_future <- requireNamespace("future", 
                        quietly = TRUE)
                      version <- if (has_future) 
                        packageVersion("future")
                      else NULL
                      if (!has_future || version < "1.8.0") {
                        info <- c(r_version = gsub("R version ", 
                          "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                          R.version$platform, 8 * .Machine$sizeof.pointer), 
                          os = paste(Sys.info()[c("sysname", "release", 
                            "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                        info <- sprintf("%s: %s", names(info), 
                          info)
                        info <- paste(info, collapse = "; ")
                        if (!has_future) {
                          msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                            info)
                        }
                        else {
                          msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                            info, version)
                        }
                        stop(msg)
                      }
                    }
                    ...future.mc.cores.old <- getOption("mc.cores")
                    options(mc.cores = 1L)
                  }
                  local({
                    for (pkg in c("future", "foreach")) {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, workers = availableCores(constraints = "multicore"), 
                  earlySignal = FALSE, label = NULL, ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  if (is.function(workers)) 
                    workers <- workers()
                  workers <- as.integer(workers)
                  stop_if_not(is.finite(workers), workers >= 1L)
                  if (workers == 1L || !supportsMulticore()) {
                    return(sequential(expr, envir = envir, substitute = FALSE, 
                      lazy = lazy, seed = seed, globals = globals, 
                      local = TRUE, label = label))
                  }
                  oopts <- options(mc.cores = workers)
                  on.exit(options(oopts))
                  future <- MulticoreFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, workers = workers, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  a <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    library("foreach")
                    {
                      plan <- future::plan()
                      stopifnot(inherits(plan, strategy2))
                      plan_a <- future::plan("list")
                      str(plan_a)
                      stopifnot(inherits(plan_a[[1]], strategy2))
                      message("foreach() - level 2 ...")
                      y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                        {
                          plan <- future::plan()
                          message(capture.output(print(plan)))
                          stopifnot(inherits(plan, "future"), inherits(plan, 
                            getOption("future.default", "sequential")))
                          plan_b <- future::plan("list")
                          str(plan_b)
                          stopifnot(inherits(plan_b[[1]], "future"), 
                            inherits(plan_b[[1]], getOption("future.default", 
                              "sequential")))
                          list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                        }
                      message("foreach() - level 2 ... DONE")
                      y
                    }
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, workers = availableCores(constraints = "multicore"), 
                    earlySignal = FALSE, label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(is.finite(workers), workers >= 
                      1L)
                    if (workers == 1L || !supportsMulticore()) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = lazy, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    oopts <- options(mc.cores = workers)
                    on.exit(options(oopts))
                    future <- MulticoreFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, workers = workers, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, workers = availableCores(constraints = "multicore"), 
                    earlySignal = FALSE, label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(is.finite(workers), workers >= 
                      1L)
                    if (workers == 1L || !supportsMulticore()) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = lazy, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    oopts <- options(mc.cores = workers)
                    on.exit(options(oopts))
                    future <- MulticoreFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, workers = workers, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  requestCore(): workers = 2
  MulticoreFuture started
  Chunk #2 of 2 ... DONE
  Launching 2 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 2
  
  List of 3
   $ a             : int 1
   $ plan_a        :List of 1
    ..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, workers = availableCores(constraints = "multicore"), 
      earlySignal = FALSE, label = NULL, ...)  
    .. ..- attr(*, "class")= chr [1:4] "multicore" "multiprocess" "future" "function"
    .. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
    ..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ a             :<environment: 8a94680> 
    ..$ plan_a        :<environment: 8a94680> 
    ..$ ...future.x_ii:<environment: 945df78> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 42920
    - packages: [0] 
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 1
  Number of futures (= number of chunks): 1
  Launching 1 futures (chunks) ...
  Chunk #1 of 1 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 42.02 KiB (43028 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  foreach() - level 2 ...
  doFuture() ...
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 0): <none>
  - dummy globals (as locals): [1] 'b'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  plan(): nbrOfWorkers() = 1
  - globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
  Retrieving globals ... DONE
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  Resolving globals: FALSE
  The total size of the 3 globals is 41.91 KiB (42920 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'a', 'plan_a', '...future.x_ii'
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  List of 3
   $ a             : int 2
   $ plan_a        :List of 1
    ..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, workers = availableCores(constraints = "multicore"), 
      earlySignal = FALSE, label = NULL, ...)  
    .. ..- attr(*, "class")= chr [1:4] "multicore" "multiprocess" "future" "function"
    .. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
    ..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ a             :<environment: 92ba128> 
    ..$ plan_a        :<environment: 92ba128> 
    ..$ ...future.x_ii:<environment: 96d9ae0> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 42920
    - packages: [0] 
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 1
  Number of futures (= number of chunks): 1
  Launching 1 futures (chunks) ...
  Chunk #1 of 1 ...
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 42.02 KiB (43028 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 0): <none>
  SequentialFuture started (and completed)
  Chunk #1 of 1 ... DONE
  Launching 1 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 1
  
   length: 0 (resolved future 1)
  resolve() on list ... DONE
  - collecting values of future
  plan(): nbrOfWorkers() = 1
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 2 ... DONE
   length: 1 (resolved future 1)
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  SequentialFuture started (and completed)
  Chunk #1 of 1 ... DONE
  Launching 1 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 1
  
   length: 0 (resolved future 1)
  resolve() on list ... DONE
  - collecting values of future
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 2 ... DONE
   length: 0 (resolved future 2)
  resolve() on list ... DONE
  - collecting values of future
  List of 1
   $ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, workers = availableCores(constraints = "multicore"), 
      earlySignal = FALSE, label = NULL, ...)  
    ..- attr(*, "class")= chr [1:4] "multicore" "multiprocess" "future" "function"
    ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  has_future <- requireNamespace("future", quietly = TRUE)
                  version <- if (has_future) 
                    packageVersion("future")
                  else NULL
                  if (!has_future || version < "1.8.0") {
                    info <- c(r_version = gsub("R version ", "", 
                      R.version$version.string), platform = sprintf("%s (%s-bit)", 
                      R.version$platform, 8 * .Machine$sizeof.pointer), 
                      os = paste(Sys.info()[c("sysname", "release", 
                        "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                    info <- sprintf("%s: %s", names(info), info)
                    info <- paste(info, collapse = "; ")
                    if (!has_future) {
                      msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                        info)
                    }
                    else {
                      msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                        info, version)
                    }
                    stop(msg)
                  }
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  b <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    plan <- future::plan()
                    message(capture.output(print(plan)))
                    stopifnot(inherits(plan, "future"), inherits(plan, 
                      getOption("future.default", "sequential")))
                    plan_b <- future::plan("list")
                    str(plan_b)
                    stopifnot(inherits(plan_b[[1]], "future"), 
                      inherits(plan_b[[1]], getOption("future.default", 
                        "sequential")))
                    list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, workers = availableCores(constraints = "multicore"), 
                    earlySignal = FALSE, label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(is.finite(workers), workers >= 
                      1L)
                    if (workers == 1L || !supportsMulticore()) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = lazy, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    oopts <- options(mc.cores = workers)
                    on.exit(options(oopts))
                    future <- MulticoreFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, workers = workers, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, workers = availableCores(constraints = "multicore"), 
      earlySignal = FALSE, label = NULL, ...)  
    ..- attr(*, "class")= chr [1:4] "multicore" "multiprocess" "future" "function"
    ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  has_future <- requireNamespace("future", quietly = TRUE)
                  version <- if (has_future) 
                    packageVersion("future")
                  else NULL
                  if (!has_future || version < "1.8.0") {
                    info <- c(r_version = gsub("R version ", "", 
                      R.version$version.string), platform = sprintf("%s (%s-bit)", 
                      R.version$platform, 8 * .Machine$sizeof.pointer), 
                      os = paste(Sys.info()[c("sysname", "release", 
                        "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                    info <- sprintf("%s: %s", names(info), info)
                    info <- paste(info, collapse = "; ")
                    if (!has_future) {
                      msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                        info)
                    }
                    else {
                      msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                        info, version)
                    }
                    stop(msg)
                  }
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  b <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    plan <- future::plan()
                    message(capture.output(print(plan)))
                    stopifnot(inherits(plan, "future"), inherits(plan, 
                      getOption("future.default", "sequential")))
                    plan_b <- future::plan("list")
                    str(plan_b)
                    stopifnot(inherits(plan_b[[1]], "future"), 
                      inherits(plan_b[[1]], getOption("future.default", 
                        "sequential")))
                    list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, workers = availableCores(constraints = "multicore"), 
                    earlySignal = FALSE, label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(is.finite(workers), workers >= 
                      1L)
                    if (workers == 1L || !supportsMulticore()) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = lazy, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    oopts <- options(mc.cores = workers)
                    on.exit(options(oopts))
                    future <- MulticoreFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, workers = workers, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 1 ... DONE
  - plan(list('multicore', 'multicore')) ... DONE
  - plan(list('multicore', 'multisession')) ...
  plan(): nbrOfWorkers() = 2
  foreach() - level 1 ...
  doFuture() ...
  - dummy globals (as locals): [1] 'a'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  The total size of the 3 globals is 124 bytes (124 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  List of 3
   $ bs            : int [1:3] 3 2 1
   $ strategy2     : chr "multisession"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ bs            :<environment: R_GlobalEnv> 
    ..$ strategy2     :<environment: R_GlobalEnv> 
    ..$ ...future.x_ii:<environment: 9b06588> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 124
    - packages: [1] 'foreach'
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 2
  Number of futures (= number of chunks): 2
  Launching 2 futures (chunks) ...
  Chunk #1 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 160 bytes (160 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 1): 'foreach'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    {
                      has_future <- requireNamespace("future", 
                        quietly = TRUE)
                      version <- if (has_future) 
                        packageVersion("future")
                      else NULL
                      if (!has_future || version < "1.8.0") {
                        info <- c(r_version = gsub("R version ", 
                          "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                          R.version$platform, 8 * .Machine$sizeof.pointer), 
                          os = paste(Sys.info()[c("sysname", "release", 
                            "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                        info <- sprintf("%s: %s", names(info), 
                          info)
                        info <- paste(info, collapse = "; ")
                        if (!has_future) {
                          msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                            info)
                        }
                        else {
                          msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                            info, version)
                        }
                        stop(msg)
                      }
                    }
                    ...future.mc.cores.old <- getOption("mc.cores")
                    options(mc.cores = 1L)
                  }
                  local({
                    for (pkg in c("future", "foreach")) {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, persistent = FALSE, workers = availableCores(), 
                  gc = FALSE, earlySignal = FALSE, label = NULL, 
                  ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  if (is.function(workers)) 
                    workers <- workers()
                  workers <- as.integer(workers)
                  stop_if_not(length(workers) == 1, is.finite(workers), 
                    workers >= 1)
                  if (workers == 1L) {
                    return(sequential(expr, envir = envir, substitute = FALSE, 
                      lazy = TRUE, seed = seed, globals = globals, 
                      local = TRUE, label = label))
                  }
                  workers <- ClusterRegistry("start", workers = workers)
                  future <- MultisessionFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, persistent = persistent, 
                    workers = workers, gc = gc, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  a <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    library("foreach")
                    {
                      plan <- future::plan()
                      stopifnot(inherits(plan, strategy2))
                      plan_a <- future::plan("list")
                      str(plan_a)
                      stopifnot(inherits(plan_a[[1]], strategy2))
                      message("foreach() - level 2 ...")
                      y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                        {
                          plan <- future::plan()
                          message(capture.output(print(plan)))
                          stopifnot(inherits(plan, "future"), inherits(plan, 
                            getOption("future.default", "sequential")))
                          plan_b <- future::plan("list")
                          str(plan_b)
                          stopifnot(inherits(plan_b[[1]], "future"), 
                            inherits(plan_b[[1]], getOption("future.default", 
                              "sequential")))
                          list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                        }
                      message("foreach() - level 2 ... DONE")
                      y
                    }
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, workers = availableCores(constraints = "multicore"), 
                    earlySignal = FALSE, label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(is.finite(workers), workers >= 
                      1L)
                    if (workers == 1L || !supportsMulticore()) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = lazy, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    oopts <- options(mc.cores = workers)
                    on.exit(options(oopts))
                    future <- MulticoreFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, workers = workers, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableCores(), 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(length(workers) == 1, is.finite(workers), 
                      workers >= 1)
                    if (workers == 1L) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = TRUE, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    workers <- ClusterRegistry("start", workers = workers)
                    future <- MultisessionFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  requestCore(): workers = 2
  MulticoreFuture started
  Chunk #1 of 2 ... DONE
  Chunk #2 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 160 bytes (160 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 1): 'foreach'
  foreach() - level 2 ...
  doFuture() ...
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    {
                      has_future <- requireNamespace("future", 
                        quietly = TRUE)
                      version <- if (has_future) 
                        packageVersion("future")
                      else NULL
                      if (!has_future || version < "1.8.0") {
                        info <- c(r_version = gsub("R version ", 
                          "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                          R.version$platform, 8 * .Machine$sizeof.pointer), 
                          os = paste(Sys.info()[c("sysname", "release", 
                            "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                        info <- sprintf("%s: %s", names(info), 
                          info)
                        info <- paste(info, collapse = "; ")
                        if (!has_future) {
                          msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                            info)
                        }
                        else {
                          msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                            info, version)
                        }
                        stop(msg)
                      }
                    }
                    ...future.mc.cores.old <- getOption("mc.cores")
                    options(mc.cores = 1L)
                  }
                  local({
                    for (pkg in c("future", "foreach")) {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, persistent = FALSE, workers = availableCores(), 
                  gc = FALSE, earlySignal = FALSE, label = NULL, 
                  ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  if (is.function(workers)) 
                    workers <- workers()
                  workers <- as.integer(workers)
                  stop_if_not(length(workers) == 1, is.finite(workers), 
                    workers >= 1)
                  if (workers == 1L) {
                    return(sequential(expr, envir = envir, substitute = FALSE, 
                      lazy = TRUE, seed = seed, globals = globals, 
                      local = TRUE, label = label))
                  }
                  workers <- ClusterRegistry("start", workers = workers)
                  future <- MultisessionFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, persistent = persistent, 
                    workers = workers, gc = gc, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  a <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    library("foreach")
                    {
                      plan <- future::plan()
                      stopifnot(inherits(plan, strategy2))
                      plan_a <- future::plan("list")
                      str(plan_a)
                      stopifnot(inherits(plan_a[[1]], strategy2))
                      message("foreach() - level 2 ...")
                      y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                        {
                          plan <- future::plan()
                          message(capture.output(print(plan)))
                          stopifnot(inherits(plan, "future"), inherits(plan, 
                            getOption("future.default", "sequential")))
                          plan_b <- future::plan("list")
                          str(plan_b)
                          stopifnot(inherits(plan_b[[1]], "future"), 
                            inherits(plan_b[[1]], getOption("future.default", 
                              "sequential")))
                          list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                        }
                      message("foreach() - level 2 ... DONE")
                      y
                    }
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, workers = availableCores(constraints = "multicore"), 
                    earlySignal = FALSE, label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(is.finite(workers), workers >= 
                      1L)
                    if (workers == 1L || !supportsMulticore()) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = lazy, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    oopts <- options(mc.cores = workers)
                    on.exit(options(oopts))
                    future <- MulticoreFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, workers = workers, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableCores(), 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(length(workers) == 1, is.finite(workers), 
                      workers >= 1)
                    if (workers == 1L) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = TRUE, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    workers <- ClusterRegistry("start", workers = workers)
                    future <- MultisessionFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  requestCore(): workers = 2
  - dummy globals (as locals): [1] 'b'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  The total size of the 3 globals is 46.34 KiB (47456 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'a', 'plan_a', '...future.x_ii'
  MulticoreFuture started
  Chunk #2 of 2 ... DONE
  Launching 2 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 2
  
  List of 3
   $ a             : int 1
   $ plan_a        :List of 1
    ..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(), 
      gc = FALSE, earlySignal = FALSE, label = NULL, ...)  
    .. ..- attr(*, "class")= chr [1:5] "multisession" "cluster" "multiprocess" "future" ...
    .. ..- attr(*, "init")= logi TRUE
    .. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
    ..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ a             :<environment: 93e2b30> 
    ..$ plan_a        :<environment: 93e2b30> 
    ..$ ...future.x_ii:<environment: 898f878> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 47456
    - packages: [0] 
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  foreach() - level 2 ...
  Number of chunks: 1
  Number of futures (= number of chunks): 1
  doFuture() ...
  Launching 1 futures (chunks) ...
  Chunk #1 of 1 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
  Resolving globals: FALSE
  - dummy globals (as locals): [1] 'b'
  - R expression:
  The total size of the 3 globals is 46.45 KiB (47564 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  getGlobalsAndPackages() ... DONE
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  Chunk #1 of 1 ... DONE
  Launching 1 futures (chunks) ... DONE
  - resolving future
  - globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
  resolve() on list ...
   recursive: 0
  Resolving globals: FALSE
   length: 1
  
  Packages needed by future strategies (n = 0): <none>
  The total size of the 3 globals is 46.34 KiB (47456 bytes)
  Packages needed by the future expression (n = 0): <none>
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'a', 'plan_a', '...future.x_ii'
  plan(): nbrOfWorkers() = 1
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  List of 3
   $ a             : int 2
   $ plan_a        :List of 1
    ..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(), 
      gc = FALSE, earlySignal = FALSE, label = NULL, ...)  
    .. ..- attr(*, "class")= chr [1:5] "multisession" "cluster" "multiprocess" "future" ...
    .. ..- attr(*, "init")= logi TRUE
    .. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
    ..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ a             :<environment: 8972748> 
    ..$ plan_a        :<environment: 8972748> 
    ..$ ...future.x_ii:<environment: 900c2c8> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 47456
    - packages: [0] 
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 1
  Number of futures (= number of chunks): 1
  Launching 1 futures (chunks) ...
  Chunk #1 of 1 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 46.45 KiB (47564 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Chunk #1 of 1 ... DONE
  Launching 1 futures (chunks) ... DONE
  resolve() on list ... DONE
  - collecting values of future
  - resolving future
  - accumulating results
  resolve() on list ...
   recursive: 0
   length: 1
  
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 2 ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 0): <none>
   length: 1 (resolved future 1)
  plan(): nbrOfWorkers() = 1
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
  SequentialFuture started (and completed)
   length: 0 (resolved future 1)
  resolve() on list ... DONE
  - collecting values of future
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 2 ... DONE
   length: 0 (resolved future 2)
  resolve() on list ... DONE
  - collecting values of future
  List of 1
   $ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(), 
      gc = FALSE, earlySignal = FALSE, label = NULL, ...)  
    ..- attr(*, "class")= chr [1:5] "multisession" "cluster" "multiprocess" "future" ...
    ..- attr(*, "init")= logi TRUE
    ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  has_future <- requireNamespace("future", quietly = TRUE)
                  version <- if (has_future) 
                    packageVersion("future")
                  else NULL
                  if (!has_future || version < "1.8.0") {
                    info <- c(r_version = gsub("R version ", "", 
                      R.version$version.string), platform = sprintf("%s (%s-bit)", 
                      R.version$platform, 8 * .Machine$sizeof.pointer), 
                      os = paste(Sys.info()[c("sysname", "release", 
                        "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                    info <- sprintf("%s: %s", names(info), info)
                    info <- paste(info, collapse = "; ")
                    if (!has_future) {
                      msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                        info)
                    }
                    else {
                      msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                        info, version)
                    }
                    stop(msg)
                  }
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  b <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    plan <- future::plan()
                    message(capture.output(print(plan)))
                    stopifnot(inherits(plan, "future"), inherits(plan, 
                      getOption("future.default", "sequential")))
                    plan_b <- future::plan("list")
                    str(plan_b)
                    stopifnot(inherits(plan_b[[1]], "future"), 
                      inherits(plan_b[[1]], getOption("future.default", 
                        "sequential")))
                    list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableCores(), 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(length(workers) == 1, is.finite(workers), 
                      workers >= 1)
                    if (workers == 1L) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = TRUE, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    workers <- ClusterRegistry("start", workers = workers)
                    future <- MultisessionFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(), 
      gc = FALSE, earlySignal = FALSE, label = NULL, ...)  
    ..- attr(*, "class")= chr [1:5] "multisession" "cluster" "multiprocess" "future" ...
    ..- attr(*, "init")= logi TRUE
    ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  has_future <- requireNamespace("future", quietly = TRUE)
                  version <- if (has_future) 
                    packageVersion("future")
                  else NULL
                  if (!has_future || version < "1.8.0") {
                    info <- c(r_version = gsub("R version ", "", 
                      R.version$version.string), platform = sprintf("%s (%s-bit)", 
                      R.version$platform, 8 * .Machine$sizeof.pointer), 
                      os = paste(Sys.info()[c("sysname", "release", 
                        "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                    info <- sprintf("%s: %s", names(info), info)
                    info <- paste(info, collapse = "; ")
                    if (!has_future) {
                      msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                        info)
                    }
                    else {
                      msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                        info, version)
                    }
                    stop(msg)
                  }
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  b <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    plan <- future::plan()
                    message(capture.output(print(plan)))
                    stopifnot(inherits(plan, "future"), inherits(plan, 
                      getOption("future.default", "sequential")))
                    plan_b <- future::plan("list")
                    str(plan_b)
                    stopifnot(inherits(plan_b[[1]], "future"), 
                      inherits(plan_b[[1]], getOption("future.default", 
                        "sequential")))
                    list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableCores(), 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(length(workers) == 1, is.finite(workers), 
                      workers >= 1)
                    if (workers == 1L) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = TRUE, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    workers <- ClusterRegistry("start", workers = workers)
                    future <- MultisessionFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 1 ... DONE
  - plan(list('multicore', 'multisession')) ... DONE
  - plan(list('multicore', 'cluster')) ...
  plan(): nbrOfWorkers() = 2
  foreach() - level 1 ...
  doFuture() ...
  - dummy globals (as locals): [1] 'a'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  The total size of the 3 globals is 116 bytes (116 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  List of 3
   $ bs            : int [1:3] 3 2 1
   $ strategy2     : chr "cluster"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ bs            :<environment: R_GlobalEnv> 
    ..$ strategy2     :<environment: R_GlobalEnv> 
    ..$ ...future.x_ii:<environment: 96038a0> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 116
    - packages: [1] 'foreach'
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 2
  Number of futures (= number of chunks): 2
  Launching 2 futures (chunks) ...
  Chunk #1 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 152 bytes (152 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 1): 'foreach'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    {
                      has_future <- requireNamespace("future", 
                        quietly = TRUE)
                      version <- if (has_future) 
                        packageVersion("future")
                      else NULL
                      if (!has_future || version < "1.8.0") {
                        info <- c(r_version = gsub("R version ", 
                          "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                          R.version$platform, 8 * .Machine$sizeof.pointer), 
                          os = paste(Sys.info()[c("sysname", "release", 
                            "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                        info <- sprintf("%s: %s", names(info), 
                          info)
                        info <- paste(info, collapse = "; ")
                        if (!has_future) {
                          msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                            info)
                        }
                        else {
                          msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                            info, version)
                        }
                        stop(msg)
                      }
                    }
                    ...future.mc.cores.old <- getOption("mc.cores")
                    options(mc.cores = 1L)
                  }
                  local({
                    for (pkg in c("future", "foreach")) {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
                  user = NULL, revtunnel = TRUE, homogeneous = TRUE, 
                  gc = FALSE, earlySignal = FALSE, label = NULL, 
                  ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  future <- ClusterFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, persistent = persistent, 
                    workers = workers, user = user, revtunnel = revtunnel, 
                    homogeneous = homogeneous, gc = gc, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  a <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    library("foreach")
                    {
                      plan <- future::plan()
                      stopifnot(inherits(plan, strategy2))
                      plan_a <- future::plan("list")
                      str(plan_a)
                      stopifnot(inherits(plan_a[[1]], strategy2))
                      message("foreach() - level 2 ...")
                      y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                        {
                          plan <- future::plan()
                          message(capture.output(print(plan)))
                          stopifnot(inherits(plan, "future"), inherits(plan, 
                            getOption("future.default", "sequential")))
                          plan_b <- future::plan("list")
                          str(plan_b)
                          stopifnot(inherits(plan_b[[1]], "future"), 
                            inherits(plan_b[[1]], getOption("future.default", 
                              "sequential")))
                          list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                        }
                      message("foreach() - level 2 ... DONE")
                      y
                    }
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, workers = availableCores(constraints = "multicore"), 
                    earlySignal = FALSE, label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(is.finite(workers), workers >= 
                      1L)
                    if (workers == 1L || !supportsMulticore()) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = lazy, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    oopts <- options(mc.cores = workers)
                    on.exit(options(oopts))
                    future <- MulticoreFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, workers = workers, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
                    user = NULL, revtunnel = TRUE, homogeneous = TRUE, 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    future <- ClusterFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, user = user, revtunnel = revtunnel, 
                      homogeneous = homogeneous, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  requestCore(): workers = 2
  MulticoreFuture started
  Chunk #1 of 2 ... DONE
  Chunk #2 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 152 bytes (152 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 1): 'foreach'
  foreach() - level 2 ...
  doFuture() ...
  - dummy globals (as locals): [1] 'b'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  The total size of the 3 globals is 36.93 KiB (37820 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'a', 'plan_a', '...future.x_ii'
  List of 3
   $ a             : int 1
   $ plan_a        :List of 1
    ..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
      user = NULL, revtunnel = TRUE, homogeneous = TRUE, gc = FALSE, earlySignal = FALSE, 
      label = NULL, ...)  
    .. ..- attr(*, "class")= chr [1:4] "cluster" "multiprocess" "future" "function"
    .. ..- attr(*, "init")= logi TRUE
    .. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
    ..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ a             :<environment: a2558f8> 
    ..$ plan_a        :<environment: a2558f8> 
    ..$ ...future.x_ii:<environment: 9478ae0> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 37820
    - packages: [0] 
    - R expression:
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    {
                      has_future <- requireNamespace("future", 
                        quietly = TRUE)
                      version <- if (has_future) 
                        packageVersion("future")
                      else NULL
                      if (!has_future || version < "1.8.0") {
                        info <- c(r_version = gsub("R version ", 
                          "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                          R.version$platform, 8 * .Machine$sizeof.pointer), 
                          os = paste(Sys.info()[c("sysname", "release", 
                            "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                        info <- sprintf("%s: %s", names(info), 
                          info)
                        info <- paste(info, collapse = "; ")
                        if (!has_future) {
                          msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                            info)
                        }
                        else {
                          msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                            info, version)
                        }
                        stop(msg)
                      }
                    }
                    ...future.mc.cores.old <- getOption("mc.cores")
                    options(mc.cores = 1L)
                  }
                  local({
                    for (pkg in c("future", "foreach")) {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
                  user = NULL, revtunnel = TRUE, homogeneous = TRUE, 
                  gc = FALSE, earlySignal = FALSE, label = NULL, 
                  ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  future <- ClusterFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, persistent = persistent, 
                    workers = workers, user = user, revtunnel = revtunnel, 
                    homogeneous = homogeneous, gc = gc, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  a <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    library("foreach")
                    {
                      plan <- future::plan()
                      stopifnot(inherits(plan, strategy2))
                      plan_a <- future::plan("list")
                      str(plan_a)
                      stopifnot(inherits(plan_a[[1]], strategy2))
                      message("foreach() - level 2 ...")
                      y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                        {
                          plan <- future::plan()
                          message(capture.output(print(plan)))
                          stopifnot(inherits(plan, "future"), inherits(plan, 
                            getOption("future.default", "sequential")))
                          plan_b <- future::plan("list")
                          str(plan_b)
                          stopifnot(inherits(plan_b[[1]], "future"), 
                            inherits(plan_b[[1]], getOption("future.default", 
                              "sequential")))
                          list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                        }
                      message("foreach() - level 2 ... DONE")
                      y
                    }
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, workers = availableCores(constraints = "multicore"), 
                    earlySignal = FALSE, label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(is.finite(workers), workers >= 
                      1L)
                    if (workers == 1L || !supportsMulticore()) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = lazy, seed = seed, globals = globals, 
  {
      doFuture::registerDoFuture()
      lapply(seq_al                  }
                    oopts <- options(mc.cores = workers)
                    on.exit(options(oopts))
                    future <- MulticoreFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, workers = workers, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
                    user = NULL, revtunnel = TRUE, homogeneous = TRUE, 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    future <- ClusterFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, user = user, revtunnel = revtunnel, 
                      homogeneous = homogeneous, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  requestCore(): workers = 2
  MulticoreFuture started
  Chunk #2 of 2 ... DONE
  Launching 2 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 2
  
  foreach() - level 2 ...
  doFuture() ...
  - dummy globals (as locals): [1] 'b'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  The total size of the 3 globals is 36.93 KiB (37820 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'a', 'plan_a', '...future.x_ii'
  List of 3
   $ a             : int 2
   $ plan_a        :List of 1
    ..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
      user = NULL, revtunnel = TRUE, homogeneous = TRUE, gc = FALSE, earlySignal = FALSE, 
      label = NULL, ...)  
    .. ..- attr(*, "class")= chr [1:4] "cluster" "multiprocess" "future" "function"
    .. ..- attr(*, "init")= logi TRUE
    .. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
    ..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ a             :<environment: 93e01e8> 
    ..$ plan_a        :<environment: 93e01e8> 
    ..$ ...future.x_ii:<environment: 897e2c0> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 37820
    - packages: [0] 
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          b <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              plan <- future::plan()
              message(capture.output(print(plan)))
              stopifnot(inherits(plan, "future"), inherits(plan, 
                  getOption("future.default", "sequential")))
              plan_b <- future::plan("list")
              str(plan_b)
              stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]], 
                  getOption("future.default", "sequential")))
              list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 1
  Number of futures (= number of chunks): 1
  Launching 1 futures (chunks) ...
  Chunk #1 of 1 ...
  Workers: [n = 1] 'localhost'
  Base port: 11630
  Creating node 1 of 1 ...
  - setting up node
  Starting worker #1 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11630 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
  Waiting for worker #1 on 'localhost' to connect back
  Connection with worker #1 on 'localhost' established
  - assigning connection UUID
  - collecting session information
  Creating node 1 of 1 ... done
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 37.04 KiB (37928 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 0): <none>
  Exporting 3 global objects (37.04 KiB) to cluster node #1 ...
  Exporting 'a' (36 bytes) to cluster node #1 ...
  Exporting 'a' (36 bytes) to cluster node #1 ... DONE
  Exporting 'plan_a' (36.90 KiB) to cluster node #1 ...
  Exporting 'plan_a' (36.90 KiB) to cluster node #1 ... DONE
  Exporting '...future.x_ii' (108 bytes) to cluster node #1 ...
  Exporting '...future.x_ii' (108 bytes) to cluster node #1 ... DONE
  Exporting 3 global objects (37.04 KiB) to cluster node #1 ... DONE
  ClusterFuture started
  Chunk #1 of 1 ... DONE
  Launching 1 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 1
  
  Connection with worker #1 on 'localhost' established
  - assigning connection UUID
  - collecting session information
  Creating node 1 of 1 ... done
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 37.04 KiB (37928 bytes)
  - globals: [3] 'a', 'plan_a', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 0): <none>
  Exporting 3 global objects (37.04 KiB) to cluster node #1 ...
  Exporting 'a' (36 bytes) to cluster node #1 ...
  Exporting 'a' (36 bytes) to cluster node #1 ... DONE
  Exporting 'plan_a' (36.90 KiB) to cluster node #1 ...
  Exporting 'plan_a' (36.90 KiB) to cluster node #1 ... DONE
  Exporting '...future.x_ii' (108 bytes) to cluster node #1 ...
  Exporting '...future.x_ii' (108 bytes) to cluster node #1 ... DONE
  Exporting 3 global objects (37.04 KiB) to cluster node #1 ... DONE
  ClusterFuture started
  Chunk #1 of 1 ... DONE
  Launching 1 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 1
  
   length: 0 (resolved future 1)
  resolve() on list ... DONE
  - collecting values of future
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 2 ... DONE
   length: 1 (resolved future 1)
   length: 0 (resolved future 1)
  resolve() on list ... DONE
  - collecting values of future
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 2 ... DONE
   length: 0 (resolved future 2)
  resolve() on list ... DONE
  - collecting values of future
  List of 1
   $ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
      user = NULL, revtunnel = TRUE, homogeneous = TRUE, gc = FALSE, earlySignal = FALSE, 
      label = NULL, ...)  
    ..- attr(*, "class")= chr [1:4] "cluster" "multiprocess" "future" "function"
    ..- attr(*, "init")= logi TRUE
    ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  has_future <- requireNamespace("future", quietly = TRUE)
                  version <- if (has_future) 
                    packageVersion("future")
                  else NULL
                  if (!has_future || version < "1.8.0") {
                    info <- c(r_version = gsub("R version ", "", 
                      R.version$version.string), platform = sprintf("%s (%s-bit)", 
                      R.version$platform, 8 * .Machine$sizeof.pointer), 
                      os = paste(Sys.info()[c("sysname", "release", 
                        "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                    info <- sprintf("%s: %s", names(info), info)
                    info <- paste(info, collapse = "; ")
                    if (!has_future) {
                      msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                        info)
                    }
                    else {
                      msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                        info, version)
                    }
                    stop(msg)
                  }
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  b <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    plan <- future::plan()
                    message(capture.output(print(plan)))
                    stopifnot(inherits(plan, "future"), inherits(plan, 
                      getOption("future.default", "sequential")))
                    plan_b <- future::plan("list")
                    str(plan_b)
                    stopifnot(inherits(plan_b[[1]], "future"), 
                      inherits(plan_b[[1]], getOption("future.default", 
                        "sequential")))
                    list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
                    user = NULL, revtunnel = TRUE, homogeneous = TRUE, 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    future <- ClusterFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, user = user, revtunnel = revtunnel, 
                      homogeneous = homogeneous, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
      user = NULL, revtunnel = TRUE, homogeneous = TRUE, gc = FALSE, earlySignal = FALSE, 
      label = NULL, ...)  
    ..- attr(*, "class")= chr [1:4] "cluster" "multiprocess" "future" "function"
    ..- attr(*, "init")= logi TRUE
    ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  has_future <- requireNamespace("future", quietly = TRUE)
                  version <- if (has_future) 
                    packageVersion("future")
                  else NULL
                  if (!has_future || version < "1.8.0") {
                    info <- c(r_version = gsub("R version ", "", 
                      R.version$version.string), platform = sprintf("%s (%s-bit)", 
                      R.version$platform, 8 * .Machine$sizeof.pointer), 
                      os = paste(Sys.info()[c("sysname", "release", 
                        "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                    info <- sprintf("%s: %s", names(info), info)
                    info <- paste(info, collapse = "; ")
                    if (!has_future) {
                      msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                        info)
                    }
                    else {
                      msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                        info, version)
                    }
                    stop(msg)
                  }
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  b <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    plan <- future::plan()
                    message(capture.output(print(plan)))
                    stopifnot(inherits(plan, "future"), inherits(plan, 
                      getOption("future.default", "sequential")))
                    plan_b <- future::plan("list")
                    str(plan_b)
                    stopifnot(inherits(plan_b[[1]], "future"), 
                      inherits(plan_b[[1]], getOption("future.default", 
                        "sequential")))
                    list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
                    user = NULL, revtunnel = TRUE, homogeneous = TRUE, 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    future <- ClusterFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, user = user, revtunnel = revtunnel, 
                      homogeneous = homogeneous, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 1 ... DONE
  - plan(list('multicore', 'cluster')) ... DONE
  - plan(list('multisession', 'sequential')) ...
  plan(): plan_init() of 'multisession', 'cluster', 'multiprocess', 'future', 'function' ...
  multisession:
  - args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(), gc = FALSE, earlySignal = FALSE, label = NULL, ...)
  - tweaked: FALSE
  - call: plan(list(a = strategy1, b = strategy2))
  Workers: [n = 2] 'localhost', 'localhost'
  Base port: 11008
  Creating node 1 of 2 ...
  - setting up node
  Starting worker #1 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11008 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
  Waiting for worker #1 on 'localhost' to connect back
  Connection with worker #1 on 'localhost' established
  - assigning connection UUID
  - collecting session information
  Creating node 1 of 2 ... done
  Creating node 2 of 2 ...
  - setting up node
  Starting worker #2 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11008 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
  Waiting for worker #2 on 'localhost' to connect back
  Connection with worker #2 on 'localhost' established
  - assigning connection UUID
  - collecting session information
  Creating node 2 of 2 ... done
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 0): <none>
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    {
                      has_future <- requireNamespace("future", 
                        quietly = TRUE)
                      version <- if (has_future) 
                        packageVersion("future")
                      else NULL
                      if (!has_future || version < "1.8.0") {
                        info <- c(r_version = gsub("R version ", 
                          "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                          R.version$platform, 8 * .Machine$sizeof.pointer), 
                          os = paste(Sys.info()[c("sysname", "release", 
                            "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                        info <- sprintf("%s: %s", names(info), 
                          info)
                        info <- paste(info, collapse = "; ")
                        if (!has_future) {
                          msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                            info)
                        }
                        else {
                          msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                            info, version)
                        }
                        stop(msg)
                      }
                    }
                    ...future.mc.cores.old <- getOption("mc.cores")
                    options(mc.cores = 1L)
                  }
                  local({
                    for (pkg in "future") {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, local = TRUE, earlySignal = FALSE, 
                  label = NULL, ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  local <- as.logical(local)
                  future <- SequentialFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, local = local, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local(NA)
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableCores(), 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(length(workers) == 1, is.finite(workers), 
                      workers >= 1)
                    if (workers == 1L) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = TRUE, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    workers <- ClusterRegistry("start", workers = workers)
                    future <- MultisessionFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, local = TRUE, earlySignal = FALSE, 
                    label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    local <- as.logical(local)
                    future <- SequentialFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, local = local, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  MultisessionFuture started
  plan(): plan_init() of 'multisession', 'cluster', 'multiprocess', 'future', 'function' ... DONE
  plan(): nbrOfWorkers() = 2
  foreach() - level 1 ...
  doFuture() ...
  - dummy globals (as locals): [1] 'a'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  The total size of the 3 globals is 124 bytes (124 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  List of 3
   $ bs            : int [1:3] 3 2 1
   $ strategy2     : chr "sequential"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ bs            :<environment: R_GlobalEnv> 
    ..$ strategy2     :<environment: R_GlobalEnv> 
    ..$ ...future.x_ii:<environment: 950ed40> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 124
    - packages: [1] 'foreach'
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 2
  Number of futures (= number of chunks): 2
  Launching 2 futures (chunks) ...
  Chunk #1 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 160 bytes (160 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 1): 'foreach'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    {
                      has_future <- requireNamespace("future", 
                        quietly = TRUE)
                      version <- if (has_future) 
                        packageVersion("future")
                      else NULL
                      if (!has_future || version < "1.8.0") {
                        info <- c(r_version = gsub("R version ", 
                          "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                          R.version$platform, 8 * .Machine$sizeof.pointer), 
                          os = paste(Sys.info()[c("sysname", "release", 
                            "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                        info <- sprintf("%s: %s", names(info), 
                          info)
                        info <- paste(info, collapse = "; ")
                        if (!has_future) {
                          msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                            info)
                        }
                        else {
                          msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                            info, version)
                        }
                        stop(msg)
                      }
                    }
                    ...future.mc.cores.old <- getOption("mc.cores")
                    options(mc.cores = 1L)
                  }
                  local({
                    for (pkg in c("future", "foreach")) {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, local = TRUE, earlySignal = FALSE, 
                  label = NULL, ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  local <- as.logical(local)
                  future <- SequentialFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, local = local, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  a <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    library("foreach")
                    {
                      plan <- future::plan()
                      stopifnot(inherits(plan, strategy2))
                      plan_a <- future::plan("list")
                      str(plan_a)
                      stopifnot(inherits(plan_a[[1]], strategy2))
                      message("foreach() - level 2 ...")
                      y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                        {
                          plan <- future::plan()
                          message(capture.output(print(plan)))
                          stopifnot(inherits(plan, "future"), inherits(plan, 
                            getOption("future.default", "sequential")))
                          plan_b <- future::plan("list")
                          str(plan_b)
                          stopifnot(inherits(plan_b[[1]], "future"), 
                            inherits(plan_b[[1]], getOption("future.default", 
                              "sequential")))
                          list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                        }
                      message("foreach() - level 2 ... DONE")
                      y
                    }
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableCores(), 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(length(workers) == 1, is.finite(workers), 
                      workers >= 1)
                    if (workers == 1L) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = TRUE, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    workers <- ClusterRegistry("start", workers = workers)
                    future <- MultisessionFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, local = TRUE, earlySignal = FALSE, 
                    label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    local <- as.logical(local)
                    future <- SequentialFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, local = local, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  Exporting 3 global objects (160 bytes) to cluster node #1 ...
  Exporting 'bs' (44 bytes) to cluster node #1 ...
  Exporting 'bs' (44 bytes) to cluster node #1 ... DONE
  Exporting 'strategy2' (80 bytes) to cluster node #1 ...
  Exporting 'strategy2' (80 bytes) to cluster node #1 ... DONE
  Exporting '...future.x_ii' (36 bytes) to cluster node #1 ...
  Exporting '...future.x_ii' (36 bytes) to cluster node #1 ... DONE
  Exporting 3 global objects (160 bytes) to cluster node #1 ... DONE
  MultisessionFuture started
  Chunk #1 of 2 ... DONE
  Chunk #2 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 160 bytes (160 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 1): 'foreach'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    {
                      has_future <- requireNamespace("future", 
                        quietly = TRUE)
                      version <- if (has_future) 
                        packageVersion("future")
                      else NULL
                      if (!has_future || version < "1.8.0") {
                        info <- c(r_version = gsub("R version ", 
                          "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                          R.version$platform, 8 * .Machine$sizeof.pointer), 
                          os = paste(Sys.info()[c("sysname", "release", 
                            "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                        info <- sprintf("%s: %s", names(info), 
                          info)
                        info <- paste(info, collapse = "; ")
                        if (!has_future) {
                          msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                            info)
                        }
                        else {
                          msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                            info, version)
                        }
                        stop(msg)
                      }
                    }
                    ...future.mc.cores.old <- getOption("mc.cores")
                    options(mc.cores = 1L)
                  }
                  local({
                    for (pkg in c("future", "foreach")) {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, local = TRUE, earlySignal = FALSE, 
                  label = NULL, ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  local <- as.logical(local)
                  future <- SequentialFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, local = local, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  a <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    library("foreach")
                    {
                      plan <- future::plan()
                      stopifnot(inherits(plan, strategy2))
                      plan_a <- future::plan("list")
                      str(plan_a)
                      stopifnot(inherits(plan_a[[1]], strategy2))
                      message("foreach() - level 2 ...")
                      y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                        {
                          plan <- future::plan()
                          message(capture.output(print(plan)))
                          stopifnot(inherits(plan, "future"), inherits(plan, 
                            getOption("future.default", "sequential")))
                          plan_b <- future::plan("list")
                          str(plan_b)
                          stopifnot(inherits(plan_b[[1]], "future"), 
                            inherits(plan_b[[1]], getOption("future.default", 
                              "sequential")))
                          list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                        }
                      message("foreach() - level 2 ... DONE")
                      y
                    }
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableCores(), 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(length(workers) == 1, is.finite(workers), 
                      workers >= 1)
                    if (workers == 1L) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = TRUE, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    workers <- ClusterRegistry("start", workers = workers)
                    future <- MultisessionFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, local = TRUE, earlySignal = FALSE, 
                    label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    local <- as.logical(local)
                    future <- SequentialFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, local = local, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  Exporting 3 global objects (160 bytes) to cluster node #2 ...
  Exporting 'bs' (44 bytes) to cluster node #2 ...
  Exporting 'bs' (44 bytes) to cluster node #2 ... DONE
  Exporting 'strategy2' (80 bytes) to cluster node #2 ...
  Exporting 'strategy2' (80 bytes) to cluster node #2 ... DONE
  Exporting '...future.x_ii' (36 bytes) to cluster node #2 ...
  Exporting '...future.x_ii' (36 bytes) to cluster node #2 ... DONE
  Exporting 3 global objects (160 bytes) to cluster node #2 ... DONE
  MultisessionFuture started
  Chunk #2 of 2 ... DONE
  Launching 2 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 2
  
   length: 1 (resolved future 1)
   length: 0 (resolved future 2)
  resolve() on list ... DONE
  - collecting values of future
  List of 1
   $ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 1 ... DONE
  - plan(list('multisession', 'sequential')) ... DONE
  - plan(list('multisession', 'multicore')) ...
  plan(): plan_init() of 'multisession', 'cluster', 'multiprocess', 'future', 'function' ...
  multisession:
  - args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(), gc = FALSE, earlySignal = FALSE, label = NULL, ...)
  - tweaked: FALSE
  - call: plan(list(a = strategy1, b = strategy2))
  Workers: [n = 2] 'localhost', 'localhost'
  Base port: 11353
  Creating node 1 of 2 ...
  - setting up node
  Starting worker #1 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11353 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
  Waiting for worker #1 on 'localhost' to connect back
  Connection with worker #1 on 'localhost' established
  - assigning connection UUID
  - collecting session information
  Creating node 1 of 2 ... done
  Creating node 2 of 2 ...
  - setting up node
  Starting worker #2 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11353 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
  Waiting for worker #2 on 'localhost' to connect back
  Connection with worker #2 on 'localhost' established
  - assigning connection UUID
  - collecting session information
  Creating node 2 of 2 ... done
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 0): <none>
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    {
                      has_future <- requireNamespace("future", 
                        quietly = TRUE)
                      version <- if (has_future) 
                        packageVersion("future")
                      else NULL
                      if (!has_future || version < "1.8.0") {
                        info <- c(r_version = gsub("R version ", 
                          "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                          R.version$platform, 8 * .Machine$sizeof.pointer), 
                          os = paste(Sys.info()[c("sysname", "release", 
                            "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                        info <- sprintf("%s: %s", names(info), 
                          info)
                        info <- paste(info, collapse = "; ")
                        if (!has_future) {
                          msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                            info)
                        }
                        else {
                          msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                            info, version)
                        }
                        stop(msg)
                      }
                    }
                    ...future.mc.cores.old <- getOption("mc.cores")
                    options(mc.cores = 1L)
                  }
                  local({
                    for (pkg in "future") {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, workers = availableCores(constraints = "multicore"), 
                  earlySignal = FALSE, label = NULL, ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  if (is.function(workers)) 
                    workers <- workers()
                  workers <- as.integer(workers)
                  stop_if_not(is.finite(workers), workers >= 1L)
                  if (workers == 1L || !supportsMulticore()) {
                    return(sequential(expr, envir = envir, substitute = FALSE, 
                      lazy = lazy, seed = seed, globals = globals, 
                      local = TRUE, label = label))
                  }
                  oopts <- options(mc.cores = workers)
                  on.exit(options(oopts))
                  future <- MulticoreFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, workers = workers, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local(NA)
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableCores(), 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(length(workers) == 1, is.finite(workers), 
                      workers >= 1)
                    if (workers == 1L) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = TRUE, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    workers <- ClusterRegistry("start", workers = workers)
                    future <- MultisessionFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, workers = availableCores(constraints = "multicore"), 
                    earlySignal = FALSE, label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(is.finite(workers), workers >= 
                      1L)
                    if (workers == 1L || !supportsMulticore()) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = lazy, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    oopts <- options(mc.cores = workers)
                    on.exit(options(oopts))
                    future <- MulticoreFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, workers = workers, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  MultisessionFuture started
  plan(): plan_init() of 'multisession', 'cluster', 'multiprocess', 'future', 'function' ... DONE
  plan(): nbrOfWorkers() = 2
  foreach() - level 1 ...
  doFuture() ...
  - dummy globals (as locals): [1] 'a'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  The total size of the 3 globals is 124 bytes (124 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  List of 3
   $ bs            : int [1:3] 3 2 1
   $ strategy2     : chr "multicore"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ bs            :<environment: R_GlobalEnv> 
    ..$ strategy2     :<environment: R_GlobalEnv> 
    ..$ ...future.x_ii:<environment: 9cb01b0> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 124
    - packages: [1] 'foreach'
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 2
  Number of futures (= number of chunks): 2
  Launching 2 futures (chunks) ...
  Chunk #1 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 160 bytes (160 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 1): 'foreach'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    {
                      has_future <- requireNamespace("future", 
                        quietly = TRUE)
                      version <- if (has_future) 
                        packageVersion("future")
                      else NULL
                      if (!has_future || version < "1.8.0") {
                        info <- c(r_version = gsub("R version ", 
                          "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                          R.version$platform, 8 * .Machine$sizeof.pointer), 
                          os = paste(Sys.info()[c("sysname", "release", 
                            "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                        info <- sprintf("%s: %s", names(info), 
                          info)
                        info <- paste(info, collapse = "; ")
                        if (!has_future) {
                          msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                            info)
                        }
                        else {
                          msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                            info, version)
                        }
                        stop(msg)
                      }
                    }
                    ...future.mc.cores.old <- getOption("mc.cores")
                    options(mc.cores = 1L)
                  }
                  local({
                    for (pkg in c("future", "foreach")) {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, workers = availableCores(constraints = "multicore"), 
                  earlySignal = FALSE, label = NULL, ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  if (is.function(workers)) 
                    workers <- workers()
                  workers <- as.integer(workers)
                  stop_if_not(is.finite(workers), workers >= 1L)
                  if (workers == 1L || !supportsMulticore()) {
                    return(sequential(expr, envir = envir, substitute = FALSE, 
                      lazy = lazy, seed = seed, globals = globals, 
                      local = TRUE, label = label))
                  }
                  oopts <- options(mc.cores = workers)
                  on.exit(options(oopts))
                  future <- MulticoreFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, workers = workers, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  a <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    library("foreach")
                    {
                      plan <- future::plan()
                      stopifnot(inherits(plan, strategy2))
                      plan_a <- future::plan("list")
                      str(plan_a)
                      stopifnot(inherits(plan_a[[1]], strategy2))
                      message("foreach() - level 2 ...")
                      y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                        {
                          plan <- future::plan()
                          message(capture.output(print(plan)))
                          stopifnot(inherits(plan, "future"), inherits(plan, 
                            getOption("future.default", "sequential")))
                          plan_b <- future::plan("list")
                          str(plan_b)
                          stopifnot(inherits(plan_b[[1]], "future"), 
                            inherits(plan_b[[1]], getOption("future.default", 
                              "sequential")))
                          list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                        }
                      message("foreach() - level 2 ... DONE")
                      y
                    }
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableCores(), 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(length(workers) == 1, is.finite(workers), 
                      workers >= 1)
                    if (workers == 1L) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = TRUE, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    workers <- ClusterRegistry("start", workers = workers)
                    future <- MultisessionFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, workers = availableCores(constraints = "multicore"), 
                    earlySignal = FALSE, label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(is.finite(workers), workers >= 
                      1L)
                    if (workers == 1L || !supportsMulticore()) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = lazy, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    oopts <- options(mc.cores = workers)
                    on.exit(options(oopts))
                    future <- MulticoreFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, workers = workers, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  Exporting 3 global objects (160 bytes) to cluster node #1 ...
  Exporting 'bs' (44 bytes) to cluster node #1 ...
  Exporting 'bs' (44 bytes) to cluster node #1 ... DONE
  Exporting 'strategy2' (80 bytes) to cluster node #1 ...
  Exporting 'strategy2' (80 bytes) to cluster node #1 ... DONE
  Exporting '...future.x_ii' (36 bytes) to cluster node #1 ...
  Exporting '...future.x_ii' (36 bytes) to cluster node #1 ... DONE
  Exporting 3 global objects (160 bytes) to cluster node #1 ... DONE
  MultisessionFuture started
  Chunk #1 of 2 ... DONE
  Chunk #2 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 160 bytes (160 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 1): 'foreach'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    {
                      has_future <- requireNamespace("future", 
                        quietly = TRUE)
                      version <- if (has_future) 
                        packageVersion("future")
                      else NULL
                      if (!has_future || version < "1.8.0") {
                        info <- c(r_version = gsub("R version ", 
                          "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                          R.version$platform, 8 * .Machine$sizeof.pointer), 
                          os = paste(Sys.info()[c("sysname", "release", 
                            "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                        info <- sprintf("%s: %s", names(info), 
                          info)
                        info <- paste(info, collapse = "; ")
                        if (!has_future) {
                          msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                            info)
                        }
                        else {
                          msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                            info, version)
                        }
                        stop(msg)
                      }
                    }
                    ...future.mc.cores.old <- getOption("mc.cores")
                    options(mc.cores = 1L)
                  }
                  local({
                    for (pkg in c("future", "foreach")) {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, workers = availableCores(constraints = "multicore"), 
                  earlySignal = FALSE, label = NULL, ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  if (is.function(workers)) 
                    workers <- workers()
                  workers <- as.integer(workers)
                  stop_if_not(is.finite(workers), workers >= 1L)
                  if (workers == 1L || !supportsMulticore()) {
                    return(sequential(expr, envir = envir, substitute = FALSE, 
                      lazy = lazy, seed = seed, globals = globals, 
                      local = TRUE, label = label))
                  }
                  oopts <- options(mc.cores = workers)
                  on.exit(options(oopts))
                  future <- MulticoreFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, workers = workers, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  a <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    library("foreach")
                    {
                      plan <- future::plan()
                      stopifnot(inherits(plan, strategy2))
                      plan_a <- future::plan("list")
                      str(plan_a)
                      stopifnot(inherits(plan_a[[1]], strategy2))
                      message("foreach() - level 2 ...")
                      y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                        {
                          plan <- future::plan()
                          message(capture.output(print(plan)))
                          stopifnot(inherits(plan, "future"), inherits(plan, 
                            getOption("future.default", "sequential")))
                          plan_b <- future::plan("list")
                          str(plan_b)
                          stopifnot(inherits(plan_b[[1]], "future"), 
                            inherits(plan_b[[1]], getOption("future.default", 
                              "sequential")))
                          list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                        }
                      message("foreach() - level 2 ... DONE")
                      y
                    }
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableCores(), 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(length(workers) == 1, is.finite(workers), 
                      workers >= 1)
                    if (workers == 1L) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = TRUE, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    workers <- ClusterRegistry("start", workers = workers)
                    future <- MultisessionFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, workers = availableCores(constraints = "multicore"), 
                    earlySignal = FALSE, label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(is.finite(workers), workers >= 
                      1L)
                    if (workers == 1L || !supportsMulticore()) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = lazy, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    oopts <- options(mc.cores = workers)
                    on.exit(options(oopts))
                    future <- MulticoreFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, workers = workers, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  Exporting 3 global objects (160 bytes) to cluster node #2 ...
  Exporting 'bs' (44 bytes) to cluster node #2 ...
  Exporting 'bs' (44 bytes) to cluster node #2 ... DONE
  Exporting 'strategy2' (80 bytes) to cluster node #2 ...
  Exporting 'strategy2' (80 bytes) to cluster node #2 ... DONE
  Exporting '...future.x_ii' (36 bytes) to cluster node #2 ...
  Exporting '...future.x_ii' (36 bytes) to cluster node #2 ... DONE
  Exporting 3 global objects (160 bytes) to cluster node #2 ... DONE
  MultisessionFuture started
  Chunk #2 of 2 ... DONE
  Launching 2 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 2
  
   length: 1 (resolved future 1)
   length: 0 (resolved future 2)
  resolve() on list ... DONE
  - collecting values of future
  List of 1
   $ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, workers = availableCores(constraints = "multicore"), 
      earlySignal = FALSE, label = NULL, ...)  
    ..- attr(*, "class")= chr [1:4] "multicore" "multiprocess" "future" "function"
    ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, workers = availableCores(constraints = "multicore"), 
      earlySignal = FALSE, label = NULL, ...)  
    ..- attr(*, "class")= chr [1:4] "multicore" "multiprocess" "future" "function"
    ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 1 ... DONE
  - plan(list('multisession', 'multicore')) ... DONE
  - plan(list('multisession', 'multisession')) ...
  plan(): plan_init() of 'multisession', 'cluster', 'multiprocess', 'future', 'function' ...
  multisession:
  - args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(), gc = FALSE, earlySignal = FALSE, label = NULL, ...)
  - tweaked: FALSE
  - call: plan(list(a = strategy1, b = strategy2))
  Workers: [n = 2] 'localhost', 'localhost'
  Base port: 11727
  Creating node 1 of 2 ...
  - setting up node
  Starting worker #1 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11727 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
  Waiting for worker #1 on 'localhost' to connect back
  Connection with worker #1 on 'localhost' established
  - assigning connection UUID
  - collecting session information
  Creating node 1 of 2 ... done
  Creating node 2 of 2 ...
  - setting up node
  Starting worker #2 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11727 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
  Waiting for worker #2 on 'localhost' to connect back
  Connection with worker #2 on 'localhost' established
  - assigning connection UUID
  - collecting session information
  Creating node 2 of 2 ... done
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 0): <none>
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    {
                      has_future <- requireNamespace("future", 
                        quietly = TRUE)
                      version <- if (has_future) 
                        packageVersion("future")
                      else NULL
                      if (!has_future || version < "1.8.0") {
                        info <- c(r_version = gsub("R version ", 
                          "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                          R.version$platform, 8 * .Machine$sizeof.pointer), 
                          os = paste(Sys.info()[c("sysname", "release", 
                            "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                        info <- sprintf("%s: %s", names(info), 
                          info)
                        info <- paste(info, collapse = "; ")
                        if (!has_future) {
                          msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                            info)
                        }
                        else {
                          msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                            info, version)
                        }
                        stop(msg)
                      }
                    }
                    ...future.mc.cores.old <- getOption("mc.cores")
                    options(mc.cores = 1L)
                  }
                  local({
                    for (pkg in "future") {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, persistent = FALSE, workers = availableCores(), 
                  gc = FALSE, earlySignal = FALSE, label = NULL, 
                  ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  if (is.function(workers)) 
                    workers <- workers()
                  workers <- as.integer(workers)
                  stop_if_not(length(workers) == 1, is.finite(workers), 
                    workers >= 1)
                  if (workers == 1L) {
                    return(sequential(expr, envir = envir, substitute = FALSE, 
                      lazy = TRUE, seed = seed, globals = globals, 
                      local = TRUE, label = label))
                  }
                  workers <- ClusterRegistry("start", workers = workers)
                  future <- MultisessionFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, persistent = persistent, 
                    workers = workers, gc = gc, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local(NA)
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableCores(), 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(length(workers) == 1, is.finite(workers), 
                      workers >= 1)
                    if (workers == 1L) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = TRUE, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    workers <- ClusterRegistry("start", workers = workers)
                    future <- MultisessionFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableCores(), 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(length(workers) == 1, is.finite(workers), 
                      workers >= 1)
                    if (workers == 1L) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = TRUE, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    workers <- ClusterRegistry("start", workers = workers)
                    future <- MultisessionFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  MultisessionFuture started
  plan(): plan_init() of 'multisession', 'cluster', 'multiprocess', 'future', 'function' ... DONE
  plan(): nbrOfWorkers() = 2
  foreach() - level 1 ...
  doFuture() ...
  - dummy globals (as locals): [1] 'a'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  The total size of the 3 globals is 124 bytes (124 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  List of 3
   $ bs            : int [1:3] 3 2 1
   $ strategy2     : chr "multisession"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ bs            :<environment: R_GlobalEnv> 
    ..$ strategy2     :<environment: R_GlobalEnv> 
    ..$ ...future.x_ii:<environment: a1bd160> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 124
    - packages: [1] 'foreach'
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 2
  Number of futures (= number of chunks): 2
  Launching 2 futures (chunks) ...
  Chunk #1 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 160 bytes (160 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 1): 'foreach'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    {
                      has_future <- requireNamespace("future", 
                        quietly = TRUE)
                      version <- if (has_future) 
                        packageVersion("future")
                      else NULL
                      if (!has_future || version < "1.8.0") {
                        info <- c(r_version = gsub("R version ", 
                          "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                          R.version$platform, 8 * .Machine$sizeof.pointer), 
                          os = paste(Sys.info()[c("sysname", "release", 
                            "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                        info <- sprintf("%s: %s", names(info), 
                          info)
                        info <- paste(info, collapse = "; ")
                        if (!has_future) {
                          msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                            info)
                        }
                        else {
                          msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                            info, version)
                        }
                        stop(msg)
                      }
                    }
                    ...future.mc.cores.old <- getOption("mc.cores")
                    options(mc.cores = 1L)
                  }
                  local({
                    for (pkg in c("future", "foreach")) {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, persistent = FALSE, workers = availableCores(), 
                  gc = FALSE, earlySignal = FALSE, label = NULL, 
                  ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  if (is.function(workers)) 
                    workers <- workers()
                  workers <- as.integer(workers)
                  stop_if_not(length(workers) == 1, is.finite(workers), 
                    workers >= 1)
                  if (workers == 1L) {
                    return(sequential(expr, envir = envir, substitute = FALSE, 
                      lazy = TRUE, seed = seed, globals = globals, 
                      local = TRUE, label = label))
                  }
                  workers <- ClusterRegistry("start", workers = workers)
                  future <- MultisessionFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, persistent = persistent, 
                    workers = workers, gc = gc, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  a <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    library("foreach")
                    {
                      plan <- future::plan()
                      stopifnot(inherits(plan, strategy2))
                      plan_a <- future::plan("list")
                      str(plan_a)
                      stopifnot(inherits(plan_a[[1]], strategy2))
                      message("foreach() - level 2 ...")
                      y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                        {
                          plan <- future::plan()
                          message(capture.output(print(plan)))
                          stopifnot(inherits(plan, "future"), inherits(plan, 
                            getOption("future.default", "sequential")))
                          plan_b <- future::plan("list")
                          str(plan_b)
                          stopifnot(inherits(plan_b[[1]], "future"), 
                            inherits(plan_b[[1]], getOption("future.default", 
                              "sequential")))
                          list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                        }
                      message("foreach() - level 2 ... DONE")
                      y
                    }
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableCores(), 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(length(workers) == 1, is.finite(workers), 
                      workers >= 1)
                    if (workers == 1L) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = TRUE, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    workers <- ClusterRegistry("start", workers = workers)
                    future <- MultisessionFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableCores(), 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(length(workers) == 1, is.finite(workers), 
                      workers >= 1)
                    if (workers == 1L) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = TRUE, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    workers <- ClusterRegistry("start", workers = workers)
                    future <- MultisessionFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  Exporting 3 global objects (160 bytes) to cluster node #1 ...
  Exporting 'bs' (44 bytes) to cluster node #1 ...
  Exporting 'bs' (44 bytes) to cluster node #1 ... DONE
  Exporting 'strategy2' (80 bytes) to cluster node #1 ...
  Exporting 'strategy2' (80 bytes) to cluster node #1 ... DONE
  Exporting '...future.x_ii' (36 bytes) to cluster node #1 ...
  Exporting '...future.x_ii' (36 bytes) to cluster node #1 ... DONE
  Exporting 3 global objects (160 bytes) to cluster node #1 ... DONE
  MultisessionFuture started
  Chunk #1 of 2 ... DONE
  Chunk #2 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 160 bytes (160 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 1): 'foreach'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    {
                      has_future <- requireNamespace("future", 
                        quietly = TRUE)
                      version <- if (has_future) 
                        packageVersion("future")
                      else NULL
                      if (!has_future || version < "1.8.0") {
                        info <- c(r_version = gsub("R version ", 
                          "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                          R.version$platform, 8 * .Machine$sizeof.pointer), 
                          os = paste(Sys.info()[c("sysname", "release", 
                            "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                        info <- sprintf("%s: %s", names(info), 
                          info)
                        info <- paste(info, collapse = "; ")
                        if (!has_future) {
                          msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                            info)
                        }
                        else {
                          msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                            info, version)
                        }
                        stop(msg)
                      }
                    }
                    ...future.mc.cores.old <- getOption("mc.cores")
                    options(mc.cores = 1L)
                  }
                  local({
                    for (pkg in c("future", "foreach")) {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, persistent = FALSE, workers = availableCores(), 
                  gc = FALSE, earlySignal = FALSE, label = NULL, 
                  ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  if (is.function(workers)) 
                    workers <- workers()
                  workers <- as.integer(workers)
                  stop_if_not(length(workers) == 1, is.finite(workers), 
                    workers >= 1)
                  if (workers == 1L) {
                    return(sequential(expr, envir = envir, substitute = FALSE, 
                      lazy = TRUE, seed = seed, globals = globals, 
                      local = TRUE, label = label))
                  }
                  workers <- ClusterRegistry("start", workers = workers)
                  future <- MultisessionFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, persistent = persistent, 
                    workers = workers, gc = gc, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  a <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    library("foreach")
                    {
                      plan <- future::plan()
                      stopifnot(inherits(plan, strategy2))
                      plan_a <- future::plan("list")
                      str(plan_a)
                      stopifnot(inherits(plan_a[[1]], strategy2))
                      message("foreach() - level 2 ...")
                      y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                        {
                          plan <- future::plan()
                          message(capture.output(print(plan)))
                          stopifnot(inherits(plan, "future"), inherits(plan, 
                            getOption("future.default", "sequential")))
                          plan_b <- future::plan("list")
                          str(plan_b)
                          stopifnot(inherits(plan_b[[1]], "future"), 
                            inherits(plan_b[[1]], getOption("future.default", 
                              "sequential")))
                          list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                        }
                      message("foreach() - level 2 ... DONE")
                      y
                    }
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableCores(), 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(length(workers) == 1, is.finite(workers), 
                      workers >= 1)
                    if (workers == 1L) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = TRUE, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    workers <- ClusterRegistry("start", workers = workers)
                    future <- MultisessionFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableCores(), 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(length(workers) == 1, is.finite(workers), 
                      workers >= 1)
                    if (workers == 1L) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = TRUE, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    workers <- ClusterRegistry("start", workers = workers)
                    future <- MultisessionFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  Exporting 3 global objects (160 bytes) to cluster node #2 ...
  Exporting 'bs' (44 bytes) to cluster node #2 ...
  Exporting 'bs' (44 bytes) to cluster node #2 ... DONE
  Exporting 'strategy2' (80 bytes) to cluster node #2 ...
  Exporting 'strategy2' (80 bytes) to cluster node #2 ... DONE
  Exporting '...future.x_ii' (36 bytes) to cluster node #2 ...
  Exporting '...future.x_ii' (36 bytes) to cluster node #2 ... DONE
  Exporting 3 global objects (160 bytes) to cluster node #2 ... DONE
  MultisessionFuture started
  Chunk #2 of 2 ... DONE
  Launching 2 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 2
  
   length: 1 (resolved future 1)
   length: 0 (resolved future 2)
  resolve() on list ... DONE
  - collecting values of future
  List of 1
   $ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(), 
      gc = FALSE, earlySignal = FALSE, label = NULL, ...)  
    ..- attr(*, "class")= chr [1:5] "multisession" "cluster" "multiprocess" "future" ...
    ..- attr(*, "init")= logi TRUE
    ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(), 
      gc = FALSE, earlySignal = FALSE, label = NULL, ...)  
    ..- attr(*, "class")= chr [1:5] "multisession" "cluster" "multiprocess" "future" ...
    ..- attr(*, "init")= logi TRUE
    ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 1 ... DONE
  - plan(list('multisession', 'multisession')) ... DONE
  - plan(list('multisession', 'cluster')) ...
  plan(): plan_init() of 'multisession', 'cluster', 'multiprocess', 'future', 'function' ...
  multisession:
  - args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(), gc = FALSE, earlySignal = FALSE, label = NULL, ...)
  - tweaked: FALSE
  - call: plan(list(a = strategy1, b = strategy2))
  Workers: [n = 2] 'localhost', 'localhost'
  Base port: 11508
  Creating node 1 of 2 ...
  - setting up node
  Starting worker #1 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11508 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
  Waiting for worker #1 on 'localhost' to connect back
  Connection with worker #1 on 'localhost' established
  - assigning connection UUID
  - collecting session information
  Creating node 1 of 2 ... done
  Creating node 2 of 2 ...
  - setting up node
  Starting worker #2 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11508 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
  Waiting for worker #2 on 'localhost' to connect back
  Connection with worker #2 on 'localhost' established
  - assigning connection UUID
  - collecting session information
  Creating node 2 of 2 ... done
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 0): <none>
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    {
                      has_future <- requireNamespace("future", 
                        quietly = TRUE)
                      version <- if (has_future) 
                        packageVersion("future")
                      else NULL
                      if (!has_future || version < "1.8.0") {
                        info <- c(r_version = gsub("R version ", 
                          "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                          R.version$platform, 8 * .Machine$sizeof.pointer), 
                          os = paste(Sys.info()[c("sysname", "release", 
                            "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                        info <- sprintf("%s: %s", names(info), 
                          info)
                        info <- paste(info, collapse = "; ")
                        if (!has_future) {
                          msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                            info)
                        }
                        else {
                          msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                            info, version)
                        }
                        stop(msg)
                      }
                    }
                    ...future.mc.cores.old <- getOption("mc.cores")
                    options(mc.cores = 1L)
                  }
                  local({
                    for (pkg in "future") {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
                  user = NULL, revtunnel = TRUE, homogeneous = TRUE, 
                  gc = FALSE, earlySignal = FALSE, label = NULL, 
                  ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  future <- ClusterFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, persistent = persistent, 
                    workers = workers, user = user, revtunnel = revtunnel, 
                    homogeneous = homogeneous, gc = gc, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local(NA)
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableCores(), 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(length(workers) == 1, is.finite(workers), 
                      workers >= 1)
                    if (workers == 1L) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = TRUE, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    workers <- ClusterRegistry("start", workers = workers)
                    future <- MultisessionFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
                    user = NULL, revtunnel = TRUE, homogeneous = TRUE, 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    future <- ClusterFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, user = user, revtunnel = revtunnel, 
                      homogeneous = homogeneous, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  MultisessionFuture started
  plan(): plan_init() of 'multisession', 'cluster', 'multiprocess', 'future', 'function' ... DONE
  plan(): nbrOfWorkers() = 2
  foreach() - level 1 ...
  doFuture() ...
  - dummy globals (as locals): [1] 'a'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  The total size of the 3 globals is 116 bytes (116 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  List of 3
   $ bs            : int [1:3] 3 2 1
   $ strategy2     : chr "cluster"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ bs            :<environment: R_GlobalEnv> 
    ..$ strategy2     :<environment: R_GlobalEnv> 
    ..$ ...future.x_ii:<environment: a26f148> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 116
    - packages: [1] 'foreach'
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 2
  Number of futures (= number of chunks): 2
  Launching 2 futures (chunks) ...
  Chunk #1 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 152 bytes (152 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 1): 'foreach'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    {
                      has_future <- requireNamespace("future", 
                        quietly = TRUE)
                      version <- if (has_future) 
                        packageVersion("future")
                      else NULL
                      if (!has_future || version < "1.8.0") {
                        info <- c(r_version = gsub("R version ", 
                          "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                          R.version$platform, 8 * .Machine$sizeof.pointer), 
                          os = paste(Sys.info()[c("sysname", "release", 
                            "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                        info <- sprintf("%s: %s", names(info), 
                          info)
                        info <- paste(info, collapse = "; ")
                        if (!has_future) {
                          msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                            info)
                        }
                        else {
                          msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                            info, version)
                        }
                        stop(msg)
                      }
                    }
                    ...future.mc.cores.old <- getOption("mc.cores")
                    options(mc.cores = 1L)
                  }
                  local({
                    for (pkg in c("future", "foreach")) {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
                  user = NULL, revtunnel = TRUE, homogeneous = TRUE, 
                  gc = FALSE, earlySignal = FALSE, label = NULL, 
                  ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  future <- ClusterFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, persistent = persistent, 
                    workers = workers, user = user, revtunnel = revtunnel, 
                    homogeneous = homogeneous, gc = gc, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  a <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    library("foreach")
                    {
                      plan <- future::plan()
                      stopifnot(inherits(plan, strategy2))
                      plan_a <- future::plan("list")
                      str(plan_a)
                      stopifnot(inherits(plan_a[[1]], strategy2))
                      message("foreach() - level 2 ...")
                      y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                        {
                          plan <- future::plan()
                          message(capture.output(print(plan)))
                          stopifnot(inherits(plan, "future"), inherits(plan, 
                            getOption("future.default", "sequential")))
                          plan_b <- future::plan("list")
                          str(plan_b)
                          stopifnot(inherits(plan_b[[1]], "future"), 
                            inherits(plan_b[[1]], getOption("future.default", 
                              "sequential")))
                          list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                        }
                      message("foreach() - level 2 ... DONE")
                      y
                    }
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableCores(), 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(length(workers) == 1, is.finite(workers), 
                      workers >= 1)
                    if (workers == 1L) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = TRUE, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    workers <- ClusterRegistry("start", workers = workers)
                    future <- MultisessionFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
                    user = NULL, revtunnel = TRUE, homogeneous = TRUE, 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    future <- ClusterFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, user = user, revtunnel = revtunnel, 
                      homogeneous = homogeneous, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  Exporting 3 global objects (152 bytes) to cluster node #1 ...
  Exporting 'bs' (44 bytes) to cluster node #1 ...
  Exporting 'bs' (44 bytes) to cluster node #1 ... DONE
  Exporting 'strategy2' (72 bytes) to cluster node #1 ...
  Exporting 'strategy2' (72 bytes) to cluster node #1 ... DONE
  Exporting '...future.x_ii' (36 bytes) to cluster node #1 ...
  Exporting '...future.x_ii' (36 bytes) to cluster node #1 ... DONE
  Exporting 3 global objects (152 bytes) to cluster node #1 ... DONE
  MultisessionFuture started
  Chunk #1 of 2 ... DONE
  Chunk #2 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 152 bytes (152 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 1): 'foreach'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    {
                      has_future <- requireNamespace("future", 
                        quietly = TRUE)
                      version <- if (has_future) 
                        packageVersion("future")
                      else NULL
                      if (!has_future || version < "1.8.0") {
                        info <- c(r_version = gsub("R version ", 
                          "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                          R.version$platform, 8 * .Machine$sizeof.pointer), 
                          os = paste(Sys.info()[c("sysname", "release", 
                            "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                        info <- sprintf("%s: %s", names(info), 
                          info)
                        info <- paste(info, collapse = "; ")
                        if (!has_future) {
                          msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                            info)
                        }
                        else {
                          msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                            info, version)
                        }
                        stop(msg)
                      }
                    }
                    ...future.mc.cores.old <- getOption("mc.cores")
                    options(mc.cores = 1L)
                  }
                  local({
                    for (pkg in c("future", "foreach")) {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
                  user = NULL, revtunnel = TRUE, homogeneous = TRUE, 
                  gc = FALSE, earlySignal = FALSE, label = NULL, 
                  ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  future <- ClusterFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, persistent = persistent, 
                    workers = workers, user = user, revtunnel = revtunnel, 
                    homogeneous = homogeneous, gc = gc, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  a <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    library("foreach")
                    {
                      plan <- future::plan()
                      stopifnot(inherits(plan, strategy2))
                      plan_a <- future::plan("list")
                      str(plan_a)
                      stopifnot(inherits(plan_a[[1]], strategy2))
                      message("foreach() - level 2 ...")
                      y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                        {
                          plan <- future::plan()
                          message(capture.output(print(plan)))
                          stopifnot(inherits(plan, "future"), inherits(plan, 
                            getOption("future.default", "sequential")))
                          plan_b <- future::plan("list")
                          str(plan_b)
                          stopifnot(inherits(plan_b[[1]], "future"), 
                            inherits(plan_b[[1]], getOption("future.default", 
                              "sequential")))
                          list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                        }
                      message("foreach() - level 2 ... DONE")
                      y
                    }
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  {
                    options(mc.cores = ...future.mc.cores.old)
                  }
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableCores(), 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(length(workers) == 1, is.finite(workers), 
                      workers >= 1)
                    if (workers == 1L) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = TRUE, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    workers <- ClusterRegistry("start", workers = workers)
                    future <- MultisessionFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
                    user = NULL, revtunnel = TRUE, homogeneous = TRUE, 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    future <- ClusterFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, user = user, revtunnel = revtunnel, 
                      homogeneous = homogeneous, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  Exporting 3 global objects (152 bytes) to cluster node #2 ...
  Exporting 'bs' (44 bytes) to cluster node #2 ...
  Exporting 'bs' (44 bytes) to cluster node #2 ... DONE
  Exporting 'strategy2' (72 bytes) to cluster node #2 ...
  Exporting 'strategy2' (72 bytes) to cluster node #2 ... DONE
  Exporting '...future.x_ii' (36 bytes) to cluster node #2 ...
  Exporting '...future.x_ii' (36 bytes) to cluster node #2 ... DONE
  Exporting 3 global objects (152 bytes) to cluster node #2 ... DONE
  MultisessionFuture started
  Chunk #2 of 2 ... DONE
  Launching 2 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 2
  
   length: 1 (resolved future 1)
   length: 0 (resolved future 2)
  resolve() on list ... DONE
  - collecting values of future
  List of 1
   $ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
      user = NULL, revtunnel = TRUE, homogeneous = TRUE, gc = FALSE, earlySignal = FALSE, 
      label = NULL, ...)  
    ..- attr(*, "class")= chr [1:4] "cluster" "multiprocess" "future" "function"
    ..- attr(*, "init")= logi TRUE
    ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
      user = NULL, revtunnel = TRUE, homogeneous = TRUE, gc = FALSE, earlySignal = FALSE, 
      label = NULL, ...)  
    ..- attr(*, "class")= chr [1:4] "cluster" "multiprocess" "future" "function"
    ..- attr(*, "init")= logi TRUE
    ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 1 ... DONE
  - plan(list('multisession', 'cluster')) ... DONE
  - plan(list('cluster', 'sequential')) ...
  plan(): plan_init() of 'cluster', 'multiprocess', 'future', 'function' ...
  cluster:
  - args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, persistent = FALSE, workers = availableWorkers(), user = NULL, revtunnel = TRUE, homogeneous = TRUE, gc = FALSE, earlySignal = FALSE, label = NULL, ...)
  - tweaked: FALSE
  - call: plan(list(a = strategy1, b = strategy2))
  Workers: [n = 2] 'localhost', 'localhost'
  Base port: 11510
  Creating node 1 of 2 ...
  - setting up node
  Starting worker #1 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11510 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
  Waiting for worker #1 on 'localhost' to connect back
  Connection with worker #1 on 'localhost' established
  - assigning connection UUID
  - collecting session information
  Creating node 1 of 2 ... done
  Creating node 2 of 2 ...
  - setting up node
  Starting worker #2 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11510 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
  Waiting for worker #2 on 'localhost' to connect back
  Connection with worker #2 on 'localhost' established
  - assigning connection UUID
  - collecting session information
  Creating node 2 of 2 ... done
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 0): <none>
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    has_future <- requireNamespace("future", quietly = TRUE)
                    version <- if (has_future) 
                      packageVersion("future")
                    else NULL
                    if (!has_future || version < "1.8.0") {
                      info <- c(r_version = gsub("R version ", 
                        "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                        R.version$platform, 8 * .Machine$sizeof.pointer), 
                        os = paste(Sys.info()[c("sysname", "release", 
                          "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                      info <- sprintf("%s: %s", names(info), info)
                      info <- paste(info, collapse = "; ")
                      if (!has_future) {
                        msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                          info)
                      }
                      else {
                        msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                          info, version)
                      }
                      stop(msg)
                    }
                  }
                  local({
                    for (pkg in "future") {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, local = TRUE, earlySignal = FALSE, 
                  label = NULL, ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  local <- as.logical(local)
                  future <- SequentialFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, local = local, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local(NA)
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
                    user = NULL, revtunnel = TRUE, homogeneous = TRUE, 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    future <- ClusterFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, user = user, revtunnel = revtunnel, 
                      homogeneous = homogeneous, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, local = TRUE, earlySignal = FALSE, 
                    label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    local <- as.logical(local)
                    future <- SequentialFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, local = local, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  ClusterFuture started
  plan(): plan_init() of 'cluster', 'multiprocess', 'future', 'function' ... DONE
  plan(): nbrOfWorkers() = 2
  foreach() - level 1 ...
  doFuture() ...
  - dummy globals (as locals): [1] 'a'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  The total size of the 3 globals is 124 bytes (124 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  List of 3
   $ bs            : int [1:3] 3 2 1
   $ strategy2     : chr "sequential"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ bs            :<environment: R_GlobalEnv> 
    ..$ strategy2     :<environment: R_GlobalEnv> 
    ..$ ...future.x_ii:<environment: a3ce820> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 124
    - packages: [1] 'foreach'
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 2
  Number of futures (= number of chunks): 2
  Launching 2 futures (chunks) ...
  Chunk #1 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 160 bytes (160 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 1): 'foreach'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    has_future <- requireNamespace("future", quietly = TRUE)
                    version <- if (has_future) 
                      packageVersion("future")
                    else NULL
                    if (!has_future || version < "1.8.0") {
                      info <- c(r_version = gsub("R version ", 
                        "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                        R.version$platform, 8 * .Machine$sizeof.pointer), 
                        os = paste(Sys.info()[c("sysname", "release", 
                          "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                      info <- sprintf("%s: %s", names(info), info)
                      info <- paste(info, collapse = "; ")
                      if (!has_future) {
                        msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                          info)
                      }
                      else {
                        msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                          info, version)
                      }
                      stop(msg)
                    }
                  }
                  local({
                    for (pkg in c("future", "foreach")) {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, local = TRUE, earlySignal = FALSE, 
                  label = NULL, ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  local <- as.logical(local)
                  future <- SequentialFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, local = local, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  a <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    library("foreach")
                    {
                      plan <- future::plan()
                      stopifnot(inherits(plan, strategy2))
                      plan_a <- future::plan("list")
                      str(plan_a)
                      stopifnot(inherits(plan_a[[1]], strategy2))
                      message("foreach() - level 2 ...")
                      y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                        {
                          plan <- future::plan()
                          message(capture.output(print(plan)))
                          stopifnot(inherits(plan, "future"), inherits(plan, 
                            getOption("future.default", "sequential")))
                          plan_b <- future::plan("list")
                          str(plan_b)
                          stopifnot(inherits(plan_b[[1]], "future"), 
                            inherits(plan_b[[1]], getOption("future.default", 
                              "sequential")))
                          list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                        }
                      message("foreach() - level 2 ... DONE")
                      y
                    }
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
                    user = NULL, revtunnel = TRUE, homogeneous = TRUE, 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    future <- ClusterFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, user = user, revtunnel = revtunnel, 
                      homogeneous = homogeneous, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, local = TRUE, earlySignal = FALSE, 
                    label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    local <- as.logical(local)
                    future <- SequentialFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, local = local, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  Exporting 3 global objects (160 bytes) to cluster node #1 ...
  Exporting 'bs' (44 bytes) to cluster node #1 ...
  Exporting 'bs' (44 bytes) to cluster node #1 ... DONE
  Exporting 'strategy2' (80 bytes) to cluster node #1 ...
  Exporting 'strategy2' (80 bytes) to cluster node #1 ... DONE
  Exporting '...future.x_ii' (36 bytes) to cluster node #1 ...
  Exporting '...future.x_ii' (36 bytes) to cluster node #1 ... DONE
  Exporting 3 global objects (160 bytes) to cluster node #1 ... DONE
  ClusterFuture started
  Chunk #1 of 2 ... DONE
  Chunk #2 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 160 bytes (160 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 1): 'foreach'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    has_future <- requireNamespace("future", quietly = TRUE)
                    version <- if (has_future) 
                      packageVersion("future")
                    else NULL
                    if (!has_future || version < "1.8.0") {
                      info <- c(r_version = gsub("R version ", 
                        "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                        R.version$platform, 8 * .Machine$sizeof.pointer), 
                        os = paste(Sys.info()[c("sysname", "release", 
                          "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                      info <- sprintf("%s: %s", names(info), info)
                      info <- paste(info, collapse = "; ")
                      if (!has_future) {
                        msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                          info)
                      }
                      else {
                        msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                          info, version)
                      }
                      stop(msg)
                    }
                  }
                  local({
                    for (pkg in c("future", "foreach")) {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, local = TRUE, earlySignal = FALSE, 
                  label = NULL, ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  local <- as.logical(local)
                  future <- SequentialFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, local = local, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  a <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    library("foreach")
                    {
                      plan <- future::plan()
                      stopifnot(inherits(plan, strategy2))
                      plan_a <- future::plan("list")
                      str(plan_a)
                      stopifnot(inherits(plan_a[[1]], strategy2))
                      message("foreach() - level 2 ...")
                      y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                        {
                          plan <- future::plan()
                          message(capture.output(print(plan)))
                          stopifnot(inherits(plan, "future"), inherits(plan, 
                            getOption("future.default", "sequential")))
                          plan_b <- future::plan("list")
                          str(plan_b)
                          stopifnot(inherits(plan_b[[1]], "future"), 
                            inherits(plan_b[[1]], getOption("future.default", 
                              "sequential")))
                          list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                        }
                      message("foreach() - level 2 ... DONE")
                      y
                    }
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
                    user = NULL, revtunnel = TRUE, homogeneous = TRUE, 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    future <- ClusterFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, user = user, revtunnel = revtunnel, 
                      homogeneous = homogeneous, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, local = TRUE, earlySignal = FALSE, 
                    label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    local <- as.logical(local)
                    future <- SequentialFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, local = local, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  Exporting 3 global objects (160 bytes) to cluster node #2 ...
  Exporting 'bs' (44 bytes) to cluster node #2 ...
  Exporting 'bs' (44 bytes) to cluster node #2 ... DONE
  Exporting 'strategy2' (80 bytes) to cluster node #2 ...
  Exporting 'strategy2' (80 bytes) to cluster node #2 ... DONE
  Exporting '...future.x_ii' (36 bytes) to cluster node #2 ...
  Exporting '...future.x_ii' (36 bytes) to cluster node #2 ... DONE
  Exporting 3 global objects (160 bytes) to cluster node #2 ... DONE
  ClusterFuture started
  Chunk #2 of 2 ... DONE
  Launching 2 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 2
  
   length: 1 (resolved future 1)
   length: 0 (resolved future 2)
  resolve() on list ... DONE
  - collecting values of future
  List of 1
   $ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  List of 1
   $ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, 
      seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, 
      ...)  
    ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
    ..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
   - attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
  - accumulating results
  - processing errors (handler = 'stop')
  - extracting results
  doFuture() ... DONE
  foreach() - level 1 ... DONE
  - plan(list('cluster', 'sequential')) ... DONE
  - plan(list('cluster', 'multicore')) ...
  plan(): plan_init() of 'cluster', 'multiprocess', 'future', 'function' ...
  cluster:
  - args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, persistent = FALSE, workers = availableWorkers(), user = NULL, revtunnel = TRUE, homogeneous = TRUE, gc = FALSE, earlySignal = FALSE, label = NULL, ...)
  - tweaked: FALSE
  - call: plan(list(a = strategy1, b = strategy2))
  Workers: [n = 2] 'localhost', 'localhost'
  Base port: 11921
  Creating node 1 of 2 ...
  - setting up node
  Starting worker #1 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11921 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
  Waiting for worker #1 on 'localhost' to connect back
  Connection with worker #1 on 'localhost' established
  - assigning connection UUID
  - collecting session information
  Creating node 1 of 2 ... done
  Creating node 2 of 2 ...
  - setting up node
  Starting worker #2 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11921 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
  Waiting for worker #2 on 'localhost' to connect back
  Connection with worker #2 on 'localhost' established
  - assigning connection UUID
  - collecting session information
  Creating node 2 of 2 ... done
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 0): <none>
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    has_future <- requireNamespace("future", quietly = TRUE)
                    version <- if (has_future) 
                      packageVersion("future")
                    else NULL
                    if (!has_future || version < "1.8.0") {
                      info <- c(r_version = gsub("R version ", 
                        "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                        R.version$platform, 8 * .Machine$sizeof.pointer), 
                        os = paste(Sys.info()[c("sysname", "release", 
                          "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                      info <- sprintf("%s: %s", names(info), info)
                      info <- paste(info, collapse = "; ")
                      if (!has_future) {
                        msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                          info)
                      }
                      else {
                        msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                          info, version)
                      }
                      stop(msg)
                    }
                  }
                  local({
                    for (pkg in "future") {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, workers = availableCores(constraints = "multicore"), 
                  earlySignal = FALSE, label = NULL, ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  if (is.function(workers)) 
                    workers <- workers()
                  workers <- as.integer(workers)
                  stop_if_not(is.finite(workers), workers >= 1L)
                  if (workers == 1L || !supportsMulticore()) {
                    return(sequential(expr, envir = envir, substitute = FALSE, 
                      lazy = lazy, seed = seed, globals = globals, 
                      local = TRUE, label = label))
                  }
                  oopts <- options(mc.cores = workers)
                  on.exit(options(oopts))
                  future <- MulticoreFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, workers = workers, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local(NA)
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
                    user = NULL, revtunnel = TRUE, homogeneous = TRUE, 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    future <- ClusterFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, user = user, revtunnel = revtunnel, 
                      homogeneous = homogeneous, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, workers = availableCores(constraints = "multicore"), 
                    earlySignal = FALSE, label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(is.finite(workers), workers >= 
                      1L)
                    if (workers == 1L || !supportsMulticore()) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = lazy, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    oopts <- options(mc.cores = workers)
                    on.exit(options(oopts))
                    future <- MulticoreFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, workers = workers, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  ClusterFuture started
  plan(): plan_init() of 'cluster', 'multiprocess', 'future', 'function' ... DONE
  plan(): nbrOfWorkers() = 2
  foreach() - level 1 ...
  doFuture() ...
  - dummy globals (as locals): [1] 'a'
  - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ...
  getGlobalsAndPackages() ...
  Retrieving globals ...
  - globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
  Retrieving globals ... DONE
  Resolving globals: FALSE
  The total size of the 3 globals is 124 bytes (124 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
    - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  List of 3
   $ bs            : int [1:3] 3 2 1
   $ strategy2     : chr "multicore"
   $ ...future.x_ii: NULL
   - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
   - attr(*, "where")=List of 3
    ..$ bs            :<environment: R_GlobalEnv> 
    ..$ strategy2     :<environment: R_GlobalEnv> 
    ..$ ...future.x_ii:<environment: a255de8> 
   - attr(*, "resolved")= logi FALSE
   - attr(*, "total_size")= num 124
    - packages: [1] 'foreach'
    - R expression:
  {
      doFuture::registerDoFuture()
      lapply(seq_along(...future.x_ii), FUN = function(jj) {
          ...future.x_jj <- ...future.x_ii[[jj]]
          a <- NULL
          ...future.env <- environment()
          local({
              for (name in names(...future.x_jj)) {
                  assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                    inherits = FALSE)
              }
          })
          tryCatch({
              library("foreach")
              {
                  plan <- future::plan()
                  stopifnot(inherits(plan, strategy2))
                  plan_a <- future::plan("list")
                  str(plan_a)
                  stopifnot(inherits(plan_a[[1]], strategy2))
                  message("foreach() - level 2 ...")
                  y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                    {
                      plan <- future::plan()
                      message(capture.output(print(plan)))
                      stopifnot(inherits(plan, "future"), inherits(plan, 
                        getOption("future.default", "sequential")))
                      plan_b <- future::plan("list")
                      str(plan_b)
                      stopifnot(inherits(plan_b[[1]], "future"), 
                        inherits(plan_b[[1]], getOption("future.default", 
                          "sequential")))
                      list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                    }
                  message("foreach() - level 2 ... DONE")
                  y
              }
          }, error = identity)
      })
  }
  - identifying globals and packages ... DONE
  Number of chunks: 2
  Number of futures (= number of chunks): 2
  Launching 2 futures (chunks) ...
  Chunk #1 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 160 bytes (160 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 1): 'foreach'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    has_future <- requireNamespace("future", quietly = TRUE)
                    version <- if (has_future) 
                      packageVersion("future")
                    else NULL
                    if (!has_future || version < "1.8.0") {
                      info <- c(r_version = gsub("R version ", 
                        "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                        R.version$platform, 8 * .Machine$sizeof.pointer), 
                        os = paste(Sys.info()[c("sysname", "release", 
                          "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                      info <- sprintf("%s: %s", names(info), info)
                      info <- paste(info, collapse = "; ")
                      if (!has_future) {
                        msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                          info)
                      }
                      else {
                        msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                          info, version)
                      }
                      stop(msg)
                    }
                  }
                  local({
                    for (pkg in c("future", "foreach")) {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, workers = availableCores(constraints = "multicore"), 
                  earlySignal = FALSE, label = NULL, ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  if (is.function(workers)) 
                    workers <- workers()
                  workers <- as.integer(workers)
                  stop_if_not(is.finite(workers), workers >= 1L)
                  if (workers == 1L || !supportsMulticore()) {
                    return(sequential(expr, envir = envir, substitute = FALSE, 
                      lazy = lazy, seed = seed, globals = globals, 
                      local = TRUE, label = label))
                  }
                  oopts <- options(mc.cores = workers)
                  on.exit(options(oopts))
                  future <- MulticoreFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, workers = workers, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  a <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    library("foreach")
                    {
                      plan <- future::plan()
                      stopifnot(inherits(plan, strategy2))
                      plan_a <- future::plan("list")
                      str(plan_a)
                      stopifnot(inherits(plan_a[[1]], strategy2))
                      message("foreach() - level 2 ...")
                      y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                        {
                          plan <- future::plan()
                          message(capture.output(print(plan)))
                          stopifnot(inherits(plan, "future"), inherits(plan, 
                            getOption("future.default", "sequential")))
                          plan_b <- future::plan("list")
                          str(plan_b)
                          stopifnot(inherits(plan_b[[1]], "future"), 
                            inherits(plan_b[[1]], getOption("future.default", 
                              "sequential")))
                          list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                        }
                      message("foreach() - level 2 ... DONE")
                      y
                    }
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
                    user = NULL, revtunnel = TRUE, homogeneous = TRUE, 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    future <- ClusterFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, user = user, revtunnel = revtunnel, 
                      homogeneous = homogeneous, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, workers = availableCores(constraints = "multicore"), 
                    earlySignal = FALSE, label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(is.finite(workers), workers >= 
                      1L)
                    if (workers == 1L || !supportsMulticore()) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = lazy, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    oopts <- options(mc.cores = workers)
                    on.exit(options(oopts))
                    future <- MulticoreFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, workers = workers, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  Exporting 3 global objects (160 bytes) to cluster node #1 ...
  Exporting 'bs' (44 bytes) to cluster node #1 ...
  Exporting 'bs' (44 bytes) to cluster node #1 ... DONE
  Exporting 'strategy2' (80 bytes) to cluster node #1 ...
  Exporting 'strategy2' (80 bytes) to cluster node #1 ... DONE
  Exporting '...future.x_ii' (36 bytes) to cluster node #1 ...
  Exporting '...future.x_ii' (36 bytes) to cluster node #1 ... DONE
  Exporting 3 global objects (160 bytes) to cluster node #1 ... DONE
  ClusterFuture started
  Chunk #1 of 2 ... DONE
  Chunk #2 of 2 ...
  getGlobalsAndPackages() ...
  - globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
  Resolving globals: FALSE
  The total size of the 3 globals is 160 bytes (160 bytes)
  - globals: [3] 'bs', 'strategy2', '...future.x_ii'
  
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 1): 'future'
  Packages needed by the future expression (n = 1): 'foreach'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore", future.globals.maxSize = NULL, 
              future.globals.method = NULL, future.globals.onMissing = "ignore", 
              future.globals.onReference = NULL, future.globals.resolve = NULL, 
              future.resolve.recursive = NULL, width = 80L)
          {
              {
                  {
                    has_future <- requireNamespace("future", quietly = TRUE)
                    version <- if (has_future) 
                      packageVersion("future")
                    else NULL
                    if (!has_future || version < "1.8.0") {
                      info <- c(r_version = gsub("R version ", 
                        "", R.version$version.string), platform = sprintf("%s (%s-bit)", 
                        R.version$platform, 8 * .Machine$sizeof.pointer), 
                        os = paste(Sys.info()[c("sysname", "release", 
                          "version")], collapse = " "), hostname = Sys.info()[["nodename"]])
                      info <- sprintf("%s: %s", names(info), info)
                      info <- paste(info, collapse = "; ")
                      if (!has_future) {
                        msg <- sprintf("Package 'future' is not installed on worker (%s)", 
                          info)
                      }
                      else {
                        msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
                          info, version)
                      }
                      stop(msg)
                    }
                  }
                  local({
                    for (pkg in c("future", "foreach")) {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan(list(b = function (expr, envir = parent.frame(), 
                  substitute = TRUE, lazy = FALSE, seed = NULL, 
                  globals = TRUE, workers = availableCores(constraints = "multicore"), 
                  earlySignal = FALSE, label = NULL, ...) 
              {
                  if (substitute) 
                    expr <- substitute(expr)
                  if (is.function(workers)) 
                    workers <- workers()
                  workers <- as.integer(workers)
                  stop_if_not(is.finite(workers), workers >= 1L)
                  if (workers == 1L || !supportsMulticore()) {
                    return(sequential(expr, envir = envir, substitute = FALSE, 
                      lazy = lazy, seed = seed, globals = globals, 
                      local = TRUE, label = label))
                  }
                  oopts <- options(mc.cores = workers)
                  on.exit(options(oopts))
                  future <- MulticoreFuture(expr = expr, envir = envir, 
                    substitute = FALSE, lazy = lazy, seed = seed, 
                    globals = globals, workers = workers, earlySignal = earlySignal, 
                    label = label, ...)
                  if (!future$lazy) 
                    future <- run(future)
                  invisible(future)
              }), .cleanup = FALSE, .init = FALSE)
          }
      }
      if (is.na(TRUE)) {
      }
      else {
          if (TRUE) {
              ...future.stdout <- rawConnection(raw(0L), open = "w")
          }
          else {
              ...future.stdout <- file(switch(.Platform$OS.type, 
                  windows = "NUL", "/dev/null"), open = "w")
          }
          sink(...future.stdout, type = "output", split = FALSE)
          on.exit(if (!is.null(...future.stdout)) {
              sink(type = "output", split = FALSE)
              close(...future.stdout)
          }, add = TRUE)
      }
      ...future.result <- tryCatch({
          ...future.value <- local({
              doFuture::registerDoFuture()
              lapply(seq_along(...future.x_ii), FUN = function(jj) {
                  ...future.x_jj <- ...future.x_ii[[jj]]
                  a <- NULL
                  ...future.env <- environment()
                  local({
                    for (name in names(...future.x_jj)) {
                      assign(name, ...future.x_jj[[name]], envir = ...future.env, 
                        inherits = FALSE)
                    }
                  })
                  tryCatch({
                    library("foreach")
                    {
                      plan <- future::plan()
                      stopifnot(inherits(plan, strategy2))
                      plan_a <- future::plan("list")
                      str(plan_a)
                      stopifnot(inherits(plan_a[[1]], strategy2))
                      message("foreach() - level 2 ...")
                      y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% 
                        {
                          plan <- future::plan()
                          message(capture.output(print(plan)))
                          stopifnot(inherits(plan, "future"), inherits(plan, 
                            getOption("future.default", "sequential")))
                          plan_b <- future::plan("list")
                          str(plan_b)
                          stopifnot(inherits(plan_b[[1]], "future"), 
                            inherits(plan_b[[1]], getOption("future.default", 
                              "sequential")))
                          list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
                        }
                      message("foreach() - level 2 ... DONE")
                      y
                    }
                  }, error = identity)
              })
          })
          future::FutureResult(value = ...future.value, version = "1.8")
      }, error = function(cond) {
          calls <- sys.calls()
          structure(list(value = NULL, value2 = NA, condition = cond, 
              calls = calls, version = "1.8"), class = "FutureResult")
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(a = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, persistent = FALSE, workers = availableWorkers(), 
                    user = NULL, revtunnel = TRUE, homogeneous = TRUE, 
                    gc = FALSE, earlySignal = FALSE, label = NULL, 
                    ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    future <- ClusterFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, persistent = persistent, 
                      workers = workers, user = user, revtunnel = revtunnel, 
                      homogeneous = homogeneous, gc = gc, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }, b = function (expr, envir = parent.frame(), 
                    substitute = TRUE, lazy = FALSE, seed = NULL, 
                    globals = TRUE, workers = availableCores(constraints = "multicore"), 
                    earlySignal = FALSE, label = NULL, ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.function(workers)) 
                      workers <- workers()
                    workers <- as.integer(workers)
                    stop_if_not(is.finite(workers), workers >= 
                      1L)
                    if (workers == 1L || !supportsMulticore()) {
                      return(sequential(expr, envir = envir, substitute = FALSE, 
                        lazy = lazy, seed = seed, globals = globals, 
                        local = TRUE, label = label))
                    }
                    oopts <- options(mc.cores = workers)
                    on.exit(options(oopts))
                    future <- MulticoreFuture(expr = expr, envir = envir, 
                      substitute = FALSE, lazy = lazy, seed = seed, 
                      globals = globals, workers = workers, earlySignal = earlySignal, 
                      label = label, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    invisible(future)
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
      if (is.na(TRUE)) {
      }
      else {
          sink(type = "output", split = FALSE)
          if (TRUE) {
              ...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
          }
          else {
              ...future.result["stdout"] <- list(NULL)
          }
          close(...future.stdout)
          ...future.stdout <- NULL
      }
      ...future.result
  }
  Exporting 3 global objects (160 bytes) to cluster node #2 ...
  Exporting 'bs' (44 bytes) to cluster node #2 ...
  Exporting 'bs' (44 bytes) to cluster node #2 ... DONE
  Exporting 'strategy2' (80 bytes) to cluster node #2 ...
  Exporting 'strategy2' (80 bytes) to cluster node #2 ... DONE
  Exporting '...future.x_ii' (36 bytes) to cluster node #2 ...
  Exporting '...future.x_ii' (36 bytes) to cluster node #2 ... DONE
  Exporting 3 global objects (160 bytes) to cluster node #2 ... DONE
  ClusterFuture started
  Chunk #2 of 2 ... DONE
  Launching 2 futures (chunks) ... DONE
  - resolving future
  resolve() on list ...
   recursive: 0
   length: 2
  
   length: 1 (resolved future 1)
   length: 0 (resolved future 2)
  resolve() on list ... DONE
  - collecting values of future
  Error in unserialize(node$con) : 
    Failed to retrieve the value of ClusterFuture from cluster node #1 (on 'localhost').  The reason reported was 'error reading from connection'
  Calls: %dopar% ... FUN -> value.Future -> result -> result.ClusterFuture
  Execution halted