Skip to content

Commit

Permalink
reverts trailing line break for miraiError; deprecates deferred evalu…
Browse files Browse the repository at this point in the history
…ation pipe
  • Loading branch information
shikokuchuo committed Sep 25, 2023
1 parent b4dcf3a commit a9a3767
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 26 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* An 'errorValue' 19 'Connection reset' is now returned for a 'mirai' if the connection to either dispatcher or an ephemeral daemon drops, for example if they have crashed, rather than remaining unresolved.
* Invalid type of '...' arguments specified to `daemons()` or `dispatcher()` now raise an error early rather than attempting to launch daemons that fail.
* Eliminates a potential crash in the host process after querying `status()` if there is no longer a connection to dispatcher.
* Reverts the trailing line break added to the end of a 'miraiError' character string.
* Deprecates the Deferred Evaluation Pipe `%>>%` in favour of a recommendation to use package `mirai.promises` for performing side effects upon 'mirai' resolution.
* Deprecated use of alias `server()` for `daemon()` is retired.
* Requires nanonext >= [0.10.0.9010].

Expand Down
8 changes: 4 additions & 4 deletions R/mirai.R
Original file line number Diff line number Diff line change
Expand Up @@ -1367,7 +1367,7 @@ print.mirai <- function(x, ...) {
#'
print.miraiError <- function(x, ...) {

cat(strcat("'miraiError' chr ", x), file = stdout())
cat(sprintf("'miraiError' chr %s\n", x), file = stdout())
invisible(x)

}
Expand Down Expand Up @@ -1527,8 +1527,8 @@ mk_mirai_error <- function(e) {
x <- .subset2(e, "call")
call <- if (length(x)) deparse(x, width.cutoff = 500L, backtick = TRUE, control = NULL, nlines = 1L)
msg <- if (is.null(call) || call == "eval(expr = ._mirai_.[[\".expr\"]], envir = ._mirai_., enclos = NULL)")
sprintf("Error: %s\n", .subset2(e, "message")) else
sprintf("Error in %s: %s\n", call, .subset2(e, "message"))
cat(msg, file = stderr());
sprintf("Error: %s", .subset2(e, "message")) else
sprintf("Error in %s: %s", call, .subset2(e, "message"))
cat(strcat(msg, "\n"), file = stderr());
`class<-`(msg, c("miraiError", "errorValue"))
}
17 changes: 6 additions & 11 deletions R/pipe.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

#' Deferred Evaluation Pipe
#'
#' Pipe a possibly unresolved value forward into a function. The piped expression
#' should be wrapped in \code{.()}.
#' [DEPRECATED] Pipe a possibly unresolved value forward into a function. The
#' piped expression should be wrapped in \code{.()}.
#'
#' @param x a 'mirai' or mirai value at \code{$data} that is possibly an
#' 'unresolvedValue'.
Expand All @@ -29,10 +29,6 @@
#' @return The evaluated result, or if the mirai value of x is an
#' 'unresolvedValue', an 'unresolvedExpr'.
#'
#' It is advisable to wrap \code{resolve()} around a piped expression to
#' ensure stability of return types, as this is guaranteed to return either
#' an 'unresolvedExpr' or 'resolvedExpr'.
#'
#' @details An 'unresolvedExpr' encapsulates the eventual evaluation result.
#' Query its \code{$data} element for resolution. Once resolved, the object
#' changes into a 'resolvedExpr' and the evaluated result will be available
Expand Down Expand Up @@ -62,12 +58,11 @@
#' Other usage is not supported and it is not a drop-in replacement for
#' magrittr's \code{\%>\%} pipe.
#'
#' @note The deferred evaluation pipe is generally used where the return value
#' of the expression is required.
#' @note THIS PIPE IS DEPRECATED AND WILL BE REMOVED IN A FUTURE PACKAGE VERSION.
#'
#' For performing side effects upon resolution of a 'mirai', the promise
#' pipe \code{\%...>\%} may be more suitable (see the package
#' \CRANpkg{mirai.promises}).
#' In nearly all cases, using package \CRANpkg{mirai.promises} with the
#' promise pipe \code{\%...>\%} will be more suitable, allowing side effects
#' to be performed upon resolution of a 'mirai'.
#'
#' @examples
#' if (interactive()) {
Expand Down
17 changes: 6 additions & 11 deletions man/deferred-execution-pipe.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a9a3767

Please sign in to comment.