Skip to content

Commit

Permalink
simple detection of language objects
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Apr 6, 2023
1 parent 0bd8050 commit cc9b375
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: mirai
Type: Package
Title: Minimalist Async Evaluation Framework for R
Version: 0.8.2.9015
Version: 0.8.2.9016
Description: Lightweight parallel code execution, local or distributed across
the network. Designed for simplicity, a 'mirai' evaluates an arbitrary
expression asynchronously, resolving automatically upon completion.
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# mirai 0.8.2.9015 (development)
# mirai 0.8.2.9016 (development)

* `mirai()` now accepts a language object as '.expr', which will be evaluated directly.
* `dispatcher()` gains the following arguments:
Expand Down
5 changes: 1 addition & 4 deletions R/mirai.R
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,7 @@ mirai <- function(.expr, ..., .args = list(), .timeout = NULL, .compute = "defau
missing(.expr) && stop("missing expression, perhaps wrap in {}?")

expr <- substitute(.expr)
if (length(expr) == 1L)
if (is.language(get0(deparse(expr, backtick = FALSE, control = NULL, nlines = 1L))))
expr <- .expr
arglist <- pairlist(.expr = expr, ...)
arglist <- pairlist(.expr = if (is.symbol(expr) && is.language(get0(expr))) .expr else expr, ...)
if (length(.args))
arglist <- c(arglist, `names<-`(.args, `storage.mode<-`(substitute(.args)[-1L], "character")))

Expand Down
2 changes: 1 addition & 1 deletion tests/tests.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ if (Sys.getenv("NOT_CRAN") == "true") {
nanotesto(status[, "instance"])
nanotestz(daemons(0))
Sys.sleep(1L)
nanotest(!is.null(launch("tcp://127.0.0.1:5555", asyncdial = FALSE)))
nanotest(is.integer(launch("tcp://127.0.0.1:5555", asyncdial = FALSE)))
Sys.sleep(1L)
}
Sys.sleep(1L)
Expand Down

0 comments on commit cc9b375

Please sign in to comment.