diff --git a/NEWS.md b/NEWS.md index eaa20cfe2..71a747dc0 100644 --- a/NEWS.md +++ b/NEWS.md @@ -14,6 +14,7 @@ * `nextmode()` improvements: + simplified function signature to take a 'refhook' argument comprising a list of serialization / unserialization functions. + registered 'refhook' functions apply to external pointer type objects only. + + no longer returns invisibly for easier confimation that the correct functions have been registered. * `reap()` updated to always return either a zero on success or else an integer 'errorValue'. * `pipe_notify()` arguments 'add', 'remove' and 'flag' now default to FALSE instead of TRUE for easier selective specification of the events to signal. * Fixes regression in release 0.10.4 that caused a potential segfault using `ncurl()` with 'follow' set to TRUE when the server returns a missing or invalid relocation address. diff --git a/R/utils.R b/R/utils.R index 921ad2c33..b62b8e244 100644 --- a/R/utils.R +++ b/R/utils.R @@ -290,21 +290,20 @@ strcat <- function(a, b) .Call(rnng_strcat, a, b) #' @param mark [default FALSE] (for advanced use only) logical value, whether to #' mark serialized data with a special bit. #' -#' @return Invisibly, a list comprising the currently-registered 'refhook' -#' functions. +#' @return A list comprising the currently-registered 'refhook' functions. #' -#' @details Calling this function without any arguments returns (invisibly) the +#' @details Calling this function without any arguments returns the #' currently-registered 'refhook' functions (and resets 'mark' to FALSE). #' #' @examples #' nextmode(refhook = list(function(x) serialize(x, NULL), unserialize), #' mark = TRUE) -#' print(nextmode()) +#' nextmode() #' #' nextmode(NULL) -#' print(nextmode()) +#' nextmode() #' #' @export #' nextmode <- function(refhook = list(), mark = FALSE) - invisible(.Call(rnng_next_mode, refhook, mark)) + .Call(rnng_next_mode, refhook, mark) diff --git a/man/nextmode.Rd b/man/nextmode.Rd index 0821515f3..261c6cf45 100644 --- a/man/nextmode.Rd +++ b/man/nextmode.Rd @@ -18,8 +18,7 @@ and return a list of external pointer objects, e.g. mark serialized data with a special bit.} } \value{ -Invisibly, a list comprising the currently-registered 'refhook' - functions. +A list comprising the currently-registered 'refhook' functions. } \description{ Configures send mode 'next' by registering functions for custom serialization @@ -27,15 +26,15 @@ Configures send mode 'next' by registering functions for custom serialization sent and received between different R sessions. } \details{ -Calling this function without any arguments returns (invisibly) the +Calling this function without any arguments returns the currently-registered 'refhook' functions (and resets 'mark' to FALSE). } \examples{ nextmode(refhook = list(function(x) serialize(x, NULL), unserialize), mark = TRUE) -print(nextmode()) +nextmode() nextmode(NULL) -print(nextmode()) +nextmode() }