From 16d5dc7dde8f252a9d90cdc705125cdc21f0066b Mon Sep 17 00:00:00 2001 From: Davis Vaughan Date: Tue, 7 Oct 2025 11:29:03 -0400 Subject: [PATCH 1/3] Bring back fast `signal_stage()` --- NEWS.md | 2 +- R/deprecated-signal.R | 93 ------------- R/signal.R | 124 ++++++++++++++++++ man/deprecated-signallers.Rd | 5 +- man/signal_stage.Rd | 35 +++++ tests/testthat/_snaps/deprecated-signal.md | 48 ------- tests/testthat/_snaps/signal.md | 47 +++++++ ...test-deprecated-signal.R => test-signal.R} | 25 ++-- 8 files changed, 218 insertions(+), 161 deletions(-) delete mode 100644 R/deprecated-signal.R create mode 100644 R/signal.R create mode 100644 man/signal_stage.Rd delete mode 100644 tests/testthat/_snaps/deprecated-signal.md create mode 100644 tests/testthat/_snaps/signal.md rename tests/testthat/{test-deprecated-signal.R => test-signal.R} (56%) diff --git a/NEWS.md b/NEWS.md index 2a7f6ef..6f451b3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,6 @@ # lifecycle (development version) -* `signal_stage()` is now deprecated. This was never hooked up to anything, and our original ideas for it never panned out, so the overhead it entails no longer feels worth it. +* The condition generated by `signal_stage()` no longer directly exposes fields such as `cnd$package` and `cnd$function_nm`. * `deprecate_soft()` and `deprecate_warn()` are faster thanks to some internal refactoring (#191, #194, #195, #201). diff --git a/R/deprecated-signal.R b/R/deprecated-signal.R deleted file mode 100644 index 44d32a0..0000000 --- a/R/deprecated-signal.R +++ /dev/null @@ -1,93 +0,0 @@ -#' Deprecated functions for signalling lifecycle stages -#' -#' @description -#' `r badge("deprecated")` -#' @name deprecated-signallers -#' @keywords internal -NULL - -#' @rdname deprecated-signallers -#' @export -signal_stage <- function(stage, what, with = NULL, env = caller_env()) { - deprecate_soft( - "1.1.0", - what = "signal_stage()", - id = "lifecycle_signal_stage" - ) - signal_stage_impl(stage, what, with, env) -} - -#' @rdname deprecated-signallers -#' @export -signal_experimental <- function(when, what, env = caller_env()) { - deprecate_soft( - "1.1.0", - what = "signal_experimental()", - id = "lifecycle_signal_experimental" - ) - signal_stage_impl("experimental", what, with = NULL, env = env) -} - -#' @rdname deprecated-signallers -#' @export -signal_superseded <- function(when, what, env = caller_env()) { - deprecate_soft( - "1.1.0", - what = "signal_superseded()", - id = "lifecycle_signal_superseded" - ) - signal_stage_impl("superseded", what, with = NULL, env = env) -} - -signal_stage_impl <- function(stage, what, with, env) { - stage <- arg_match0(stage, c("experimental", "superseded", "deprecated")) - cnd <- new_lifecycle_stage_cnd(stage, what, with, env) - cnd_signal(cnd) -} - -new_lifecycle_stage_cnd <- function(stage, what, with, env) { - out <- list(stage = stage, what = what, with = with, env = env) - class(out) <- c("lifecycle_stage", "condition") - out -} - -lifecycle_stage_cnd_data <- function(cnd) { - stage <- cnd$stage - what <- cnd$what - with <- cnd$with - env <- cnd$env - - what <- spec(what, env = env) - - if (is_null(what$arg)) { - message <- sprintf("%s() is %s", what$fn, stage) - } else { - message <- sprintf("%s(%s) is %s", what$fn, what$arg, stage) - } - - if (!is_null(with)) { - with <- spec(with, NULL, "signal_stage") - message <- paste0(message, "\n", lifecycle_message_with(with, what)) - } - - list( - message = message, - stage = stage, - package = what$pkg, - function_nm = what$fn, - argument = what$arg, - reason = what$reason - ) -} - -# `cnd_signal()` calls `signalCondition()`, which currently eagerly evaluates -# `conditionMessage()`, meaning that right now we don't save any time by making -# the message generation lazy. But we are hoping to fix this in base R in the -# future, since the message is only used in the error path and could be -# generated on demand at that point. -# https://github.com/wch/r-source/blob/f200c30b1a20dfa9394d7facff616e9cb2a42c6d/src/library/base/R/conditions.R#L157-L163 -# https://github.com/wch/r-source/blob/f200c30b1a20dfa9394d7facff616e9cb2a42c6d/src/main/errors.c#L1904-L1909 -#' @export -conditionMessage.lifecycle_stage <- function(c) { - lifecycle_stage_cnd_data(c)$message -} diff --git a/R/signal.R b/R/signal.R new file mode 100644 index 0000000..8f83d17 --- /dev/null +++ b/R/signal.R @@ -0,0 +1,124 @@ +#' Signal other experimental or superseded features +#' +#' @description +#' `r badge("experimental")` +#' +#' `signal_stage()` allows you to signal life cycle stages other than +#' deprecation (for which you should use [deprecate_warn()] and friends). There +#' is no behaviour associated with this signal, it is currently purely a way to +#' express intent at the call site. +#' +#' @param stage Life cycle stage, either `"experimental"` or `"superseded"`. +#' +#' @param what String describing what feature the stage applies too, using the +#' same syntax as [deprecate_warn()]. +#' +#' @param with An optional string giving a recommended replacement for a +#' superseded function. +#' +#' @param env Environment to determine where `signal_stage()` was called, used +#' to determine the package name. +#' +#' @export +#' @examples +#' foofy <- function(x, y, z) { +#' signal_stage("experimental", "foofy()") +#' x + y / z +#' } +#' foofy(1, 2, 3) +signal_stage <- function(stage, what, with = NULL, env = caller_env()) { + stage <- arg_match0(stage, c("experimental", "superseded")) + + # Validation isn't done on `what` and `with` right now, for performance + cnd <- new_lifecycle_stage_cnd(stage, what, with, env) + + # Use `signalCondition()` over `cnd_signal()` to avoid the extra overhead. + # `cnd_signal()` installs an `rlang_muffle` restart that we don't need. + signalCondition(cnd) +} + +new_lifecycle_stage_cnd <- function(stage, what, with, env) { + out <- list(stage = stage, what = what, with = with, env = env) + class(out) <- c("lifecycle_stage", "condition") + out +} + +# We could export this if packages have a need to capture a lifecycle condition +# and manipulate this data to generate their own custom message. Currently it is +# only used for tests. +lifecycle_stage_cnd_data <- function(cnd) { + stage <- cnd$stage + what <- cnd$what + with <- cnd$with + env <- cnd$env + + what <- spec(what, env = env) + + if (is_null(what$arg)) { + message <- sprintf("%s() is %s", what$fn, stage) + } else { + message <- sprintf("%s(%s) is %s", what$fn, what$arg, stage) + } + + if (!is_null(with)) { + with <- spec(with, NULL, "signal_stage") + message <- paste0(message, "\n", lifecycle_message_with(with, what)) + } + + list( + message = message, + stage = stage, + package = what$pkg, + function_nm = what$fn, + argument = what$arg, + reason = what$reason + ) +} + +# `signalCondition()` currently eagerly evaluates `conditionMessage()`, meaning +# that we can't actually make a lazy message. Because we want `signal_stage()` +# to be performant, we instead just emit a static `""` as our message, which is +# only ever seen if someone were to catch the condition with `catch_cnd()` and +# then print it out, which is highly unlikely. +# +# We are hoping to fix this in base R in the future, since the message is only +# used for error conditions in combination with the debugger, and could be +# generated on demand for this case. +# https://github.com/wch/r-source/blob/f200c30b1a20dfa9394d7facff616e9cb2a42c6d/src/library/base/R/conditions.R#L157-L163 +# https://github.com/wch/r-source/blob/f200c30b1a20dfa9394d7facff616e9cb2a42c6d/src/main/errors.c#L1904-L1909 +#' @export +conditionMessage.lifecycle_stage <- function(c) { + "" +} + +#' Deprecated functions for signalling lifecycle stages +#' +#' @description +#' `r badge("deprecated")` +#' @name deprecated-signallers +#' @keywords internal +NULL + +#' @rdname deprecated-signallers +#' @export +signal_experimental <- function(when, what, env = caller_env()) { + deprecate_soft( + "1.1.0", + what = "signal_experimental()", + with = "signal_stage()", + id = "lifecycle_signal_experimental" + ) + signal_stage("experimental", what, with = NULL, env = env) +} + +#' @rdname deprecated-signallers +#' @export +signal_superseded <- function(when, what, env = caller_env()) { + deprecate_soft( + "1.1.0", + what = "signal_superseded()", + with = "signal_stage()", + id = "lifecycle_signal_superseded" + ) + signal_stage("superseded", what, with = NULL, env = env) +} diff --git a/man/deprecated-signallers.Rd b/man/deprecated-signallers.Rd index ae0ecee..0b92e72 100644 --- a/man/deprecated-signallers.Rd +++ b/man/deprecated-signallers.Rd @@ -1,14 +1,11 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/deprecated-signal.R +% Please edit documentation in R/signal.R \name{deprecated-signallers} \alias{deprecated-signallers} -\alias{signal_stage} \alias{signal_experimental} \alias{signal_superseded} \title{Deprecated functions for signalling lifecycle stages} \usage{ -signal_stage(stage, what, with = NULL, env = caller_env()) - signal_experimental(when, what, env = caller_env()) signal_superseded(when, what, env = caller_env()) diff --git a/man/signal_stage.Rd b/man/signal_stage.Rd new file mode 100644 index 0000000..8a5bf39 --- /dev/null +++ b/man/signal_stage.Rd @@ -0,0 +1,35 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/signal.R +\name{signal_stage} +\alias{signal_stage} +\title{Signal other experimental or superseded features} +\usage{ +signal_stage(stage, what, with = NULL, env = caller_env()) +} +\arguments{ +\item{stage}{Life cycle stage, either \code{"experimental"} or \code{"superseded"}.} + +\item{what}{String describing what feature the stage applies too, using the +same syntax as \code{\link[=deprecate_warn]{deprecate_warn()}}.} + +\item{with}{An optional string giving a recommended replacement for a +superseded function.} + +\item{env}{Environment to determine where \code{signal_stage()} was called, used +to determine the package name.} +} +\description{ +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} + +\code{signal_stage()} allows you to signal life cycle stages other than +deprecation (for which you should use \code{\link[=deprecate_warn]{deprecate_warn()}} and friends). There +is no behaviour associated with this signal, it is currently purely a way to +express intent at the call site. +} +\examples{ +foofy <- function(x, y, z) { + signal_stage("experimental", "foofy()") + x + y / z +} +foofy(1, 2, 3) +} diff --git a/tests/testthat/_snaps/deprecated-signal.md b/tests/testthat/_snaps/deprecated-signal.md deleted file mode 100644 index f1b5e3c..0000000 --- a/tests/testthat/_snaps/deprecated-signal.md +++ /dev/null @@ -1,48 +0,0 @@ -# signal generates user friendly message - - Code - (expect_condition(signal_stage("experimental", "foo()"))) - Output - - Code - (expect_condition(signal_stage("superseded", "foo(bar)"))) - Output - - -# signal_stage supports with - - Code - (expect_condition(signal_stage("superseded", "foo()", "bar()"))) - Output - - Code - (expect_condition(signal_stage("superseded", "foo(bar=)", "foo(baz=)"))) - Output - - -# `signal_stage()` and friends are deprecated - - Code - signal_stage("superseded", "foo()", "bar()") - Condition - Warning: - `signal_stage()` was deprecated in lifecycle 1.1.0. - ---- - - Code - signal_experimental("1.1.0", "foo()") - Condition - Warning: - `signal_experimental()` was deprecated in lifecycle 1.1.0. - ---- - - Code - signal_superseded("1.1.0", "foo()") - Condition - Warning: - `signal_superseded()` was deprecated in lifecycle 1.1.0. - diff --git a/tests/testthat/_snaps/signal.md b/tests/testthat/_snaps/signal.md new file mode 100644 index 0000000..0d83773 --- /dev/null +++ b/tests/testthat/_snaps/signal.md @@ -0,0 +1,47 @@ +# signal message emits class name, but no message + + Code + (expect_condition(signal_stage("experimental", "foo()"))) + Output + + Code + (expect_condition(signal_stage("superseded", "foo(bar)"))) + Output + + +# `signal_stage()` supports `with` + + Code + lifecycle_stage_cnd_data(cnd)$message + Output + [1] "foo() is superseded\nPlease use `bar()` instead." + +--- + + Code + lifecycle_stage_cnd_data(cnd)$message + Output + [1] "foo(bar) is superseded\nPlease use the `baz` argument instead." + +# `signal_experimental()` and `signal_superseded()` are deprecated + + Code + signal_experimental("1.1.0", "foo()") + Condition + Warning: + `signal_experimental()` was deprecated in lifecycle 1.1.0. + i Please use `signal_stage()` instead. + Output + NULL + +--- + + Code + signal_superseded("1.1.0", "foo()") + Condition + Warning: + `signal_superseded()` was deprecated in lifecycle 1.1.0. + i Please use `signal_stage()` instead. + Output + NULL + diff --git a/tests/testthat/test-deprecated-signal.R b/tests/testthat/test-signal.R similarity index 56% rename from tests/testthat/test-deprecated-signal.R rename to tests/testthat/test-signal.R index 3b21e21..f7911e0 100644 --- a/tests/testthat/test-deprecated-signal.R +++ b/tests/testthat/test-signal.R @@ -1,12 +1,12 @@ test_that("signal stage captures desired data", { - local_options(lifecycle_verbosity = "quiet") - f <- function() { signal_stage("experimental", "pkg::foo(bar = 'baz')") } cnd <- expect_condition(f(), class = "lifecycle_stage") data <- lifecycle_stage_cnd_data(cnd) + + expect_equal(data$message, "foo(bar) is experimental") expect_equal(data$stage, "experimental") expect_equal(data$package, "pkg") expect_equal(data$function_nm, "foo") @@ -14,28 +14,23 @@ test_that("signal stage captures desired data", { expect_equal(data$reason, "baz") }) -test_that("signal generates user friendly message", { - local_options(lifecycle_verbosity = "quiet") - +test_that("signal message emits class name, but no message", { + # See notes on `conditionMessage.lifecycle_stage()` expect_snapshot({ (expect_condition(signal_stage("experimental", "foo()"))) (expect_condition(signal_stage("superseded", "foo(bar)"))) }) }) -test_that("signal_stage supports with", { - local_options(lifecycle_verbosity = "quiet") +test_that("`signal_stage()` supports `with`", { + cnd <- catch_cnd(signal_stage("superseded", "foo()", "bar()")) + expect_snapshot(lifecycle_stage_cnd_data(cnd)$message) - expect_snapshot({ - (expect_condition(signal_stage("superseded", "foo()", "bar()"))) - (expect_condition(signal_stage("superseded", "foo(bar=)", "foo(baz=)"))) - }) + cnd <- catch_cnd(signal_stage("superseded", "foo(bar=)", "foo(baz=)")) + expect_snapshot(lifecycle_stage_cnd_data(cnd)$message) }) -test_that("`signal_stage()` and friends are deprecated", { - expect_snapshot({ - signal_stage("superseded", "foo()", "bar()") - }) +test_that("`signal_experimental()` and `signal_superseded()` are deprecated", { expect_snapshot({ signal_experimental("1.1.0", "foo()") }) From 6dfb62e5de817c78496b66402193051a0eb6ebea Mon Sep 17 00:00:00 2001 From: Davis Vaughan Date: Tue, 7 Oct 2025 12:04:06 -0400 Subject: [PATCH 2/3] What if we just did nothing? --- NAMESPACE | 1 - NEWS.md | 2 +- R/signal.R | 73 +++------------------------------ man/signal_stage.Rd | 5 +-- tests/testthat/_snaps/signal.md | 29 ------------- tests/testthat/test-signal.R | 32 +-------------- 6 files changed, 11 insertions(+), 131 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 20fd619..f4ab3e5 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,6 +1,5 @@ # Generated by roxygen2: do not edit by hand -S3method(conditionMessage,lifecycle_stage) S3method(print,lifecycle_warnings) export(badge) export(deprecate_soft) diff --git a/NEWS.md b/NEWS.md index 6f451b3..d2d9eaa 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,6 @@ # lifecycle (development version) -* The condition generated by `signal_stage()` no longer directly exposes fields such as `cnd$package` and `cnd$function_nm`. +* `signal_stage()` no longer does anything, and is now purely a way to express intent at the call site of whether a function is superseded or experimental (#203). * `deprecate_soft()` and `deprecate_warn()` are faster thanks to some internal refactoring (#191, #194, #195, #201). diff --git a/R/signal.R b/R/signal.R index 8f83d17..8497df2 100644 --- a/R/signal.R +++ b/R/signal.R @@ -16,8 +16,7 @@ #' @param with An optional string giving a recommended replacement for a #' superseded function. #' -#' @param env Environment to determine where `signal_stage()` was called, used -#' to determine the package name. +#' @param env `r badge("deprecated")` #' #' @export #' @examples @@ -26,69 +25,9 @@ #' x + y / z #' } #' foofy(1, 2, 3) -signal_stage <- function(stage, what, with = NULL, env = caller_env()) { - stage <- arg_match0(stage, c("experimental", "superseded")) - - # Validation isn't done on `what` and `with` right now, for performance - cnd <- new_lifecycle_stage_cnd(stage, what, with, env) - - # Use `signalCondition()` over `cnd_signal()` to avoid the extra overhead. - # `cnd_signal()` installs an `rlang_muffle` restart that we don't need. - signalCondition(cnd) -} - -new_lifecycle_stage_cnd <- function(stage, what, with, env) { - out <- list(stage = stage, what = what, with = with, env = env) - class(out) <- c("lifecycle_stage", "condition") - out -} - -# We could export this if packages have a need to capture a lifecycle condition -# and manipulate this data to generate their own custom message. Currently it is -# only used for tests. -lifecycle_stage_cnd_data <- function(cnd) { - stage <- cnd$stage - what <- cnd$what - with <- cnd$with - env <- cnd$env - - what <- spec(what, env = env) - - if (is_null(what$arg)) { - message <- sprintf("%s() is %s", what$fn, stage) - } else { - message <- sprintf("%s(%s) is %s", what$fn, what$arg, stage) - } - - if (!is_null(with)) { - with <- spec(with, NULL, "signal_stage") - message <- paste0(message, "\n", lifecycle_message_with(with, what)) - } - - list( - message = message, - stage = stage, - package = what$pkg, - function_nm = what$fn, - argument = what$arg, - reason = what$reason - ) -} - -# `signalCondition()` currently eagerly evaluates `conditionMessage()`, meaning -# that we can't actually make a lazy message. Because we want `signal_stage()` -# to be performant, we instead just emit a static `""` as our message, which is -# only ever seen if someone were to catch the condition with `catch_cnd()` and -# then print it out, which is highly unlikely. -# -# We are hoping to fix this in base R in the future, since the message is only -# used for error conditions in combination with the debugger, and could be -# generated on demand for this case. -# https://github.com/wch/r-source/blob/f200c30b1a20dfa9394d7facff616e9cb2a42c6d/src/library/base/R/conditions.R#L157-L163 -# https://github.com/wch/r-source/blob/f200c30b1a20dfa9394d7facff616e9cb2a42c6d/src/main/errors.c#L1904-L1909 -#' @export -conditionMessage.lifecycle_stage <- function(c) { - "" +signal_stage <- function(stage, what, with = NULL, env = deprecated()) { + # Does nothing + invisible() } #' Deprecated functions for signalling lifecycle stages @@ -108,7 +47,7 @@ signal_experimental <- function(when, what, env = caller_env()) { with = "signal_stage()", id = "lifecycle_signal_experimental" ) - signal_stage("experimental", what, with = NULL, env = env) + signal_stage("experimental", what) } #' @rdname deprecated-signallers @@ -120,5 +59,5 @@ signal_superseded <- function(when, what, env = caller_env()) { with = "signal_stage()", id = "lifecycle_signal_superseded" ) - signal_stage("superseded", what, with = NULL, env = env) + signal_stage("superseded", what) } diff --git a/man/signal_stage.Rd b/man/signal_stage.Rd index 8a5bf39..a679f7d 100644 --- a/man/signal_stage.Rd +++ b/man/signal_stage.Rd @@ -4,7 +4,7 @@ \alias{signal_stage} \title{Signal other experimental or superseded features} \usage{ -signal_stage(stage, what, with = NULL, env = caller_env()) +signal_stage(stage, what, with = NULL, env = deprecated()) } \arguments{ \item{stage}{Life cycle stage, either \code{"experimental"} or \code{"superseded"}.} @@ -15,8 +15,7 @@ same syntax as \code{\link[=deprecate_warn]{deprecate_warn()}}.} \item{with}{An optional string giving a recommended replacement for a superseded function.} -\item{env}{Environment to determine where \code{signal_stage()} was called, used -to determine the package name.} +\item{env}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}}} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} diff --git a/tests/testthat/_snaps/signal.md b/tests/testthat/_snaps/signal.md index 0d83773..2e26cd4 100644 --- a/tests/testthat/_snaps/signal.md +++ b/tests/testthat/_snaps/signal.md @@ -1,28 +1,3 @@ -# signal message emits class name, but no message - - Code - (expect_condition(signal_stage("experimental", "foo()"))) - Output - - Code - (expect_condition(signal_stage("superseded", "foo(bar)"))) - Output - - -# `signal_stage()` supports `with` - - Code - lifecycle_stage_cnd_data(cnd)$message - Output - [1] "foo() is superseded\nPlease use `bar()` instead." - ---- - - Code - lifecycle_stage_cnd_data(cnd)$message - Output - [1] "foo(bar) is superseded\nPlease use the `baz` argument instead." - # `signal_experimental()` and `signal_superseded()` are deprecated Code @@ -31,8 +6,6 @@ Warning: `signal_experimental()` was deprecated in lifecycle 1.1.0. i Please use `signal_stage()` instead. - Output - NULL --- @@ -42,6 +15,4 @@ Warning: `signal_superseded()` was deprecated in lifecycle 1.1.0. i Please use `signal_stage()` instead. - Output - NULL diff --git a/tests/testthat/test-signal.R b/tests/testthat/test-signal.R index f7911e0..051098c 100644 --- a/tests/testthat/test-signal.R +++ b/tests/testthat/test-signal.R @@ -1,33 +1,5 @@ -test_that("signal stage captures desired data", { - f <- function() { - signal_stage("experimental", "pkg::foo(bar = 'baz')") - } - - cnd <- expect_condition(f(), class = "lifecycle_stage") - data <- lifecycle_stage_cnd_data(cnd) - - expect_equal(data$message, "foo(bar) is experimental") - expect_equal(data$stage, "experimental") - expect_equal(data$package, "pkg") - expect_equal(data$function_nm, "foo") - expect_equal(data$argument, "bar") - expect_equal(data$reason, "baz") -}) - -test_that("signal message emits class name, but no message", { - # See notes on `conditionMessage.lifecycle_stage()` - expect_snapshot({ - (expect_condition(signal_stage("experimental", "foo()"))) - (expect_condition(signal_stage("superseded", "foo(bar)"))) - }) -}) - -test_that("`signal_stage()` supports `with`", { - cnd <- catch_cnd(signal_stage("superseded", "foo()", "bar()")) - expect_snapshot(lifecycle_stage_cnd_data(cnd)$message) - - cnd <- catch_cnd(signal_stage("superseded", "foo(bar=)", "foo(baz=)")) - expect_snapshot(lifecycle_stage_cnd_data(cnd)$message) +test_that("`signal_stage()` does nothing", { + expect_null(signal_stage("experimental", "pkg::foo(bar = 'baz')"), NULL) }) test_that("`signal_experimental()` and `signal_superseded()` are deprecated", { From 05b2be2b1f25b60383e7fb32510083a2ad412ac4 Mon Sep 17 00:00:00 2001 From: Davis Vaughan Date: Thu, 9 Oct 2025 15:31:59 -0400 Subject: [PATCH 3/3] Mention `declare()` --- R/signal.R | 3 ++- man/signal_stage.Rd | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/R/signal.R b/R/signal.R index 8497df2..cb2be1f 100644 --- a/R/signal.R +++ b/R/signal.R @@ -6,7 +6,8 @@ #' `signal_stage()` allows you to signal life cycle stages other than #' deprecation (for which you should use [deprecate_warn()] and friends). There #' is no behaviour associated with this signal, it is currently purely a way to -#' express intent at the call site. +#' express intent at the call site. In the future, we hope to replace this with +#' a standardized call to `base::declare()`. #' #' @param stage Life cycle stage, either `"experimental"` or `"superseded"`. #' diff --git a/man/signal_stage.Rd b/man/signal_stage.Rd index a679f7d..9c943d6 100644 --- a/man/signal_stage.Rd +++ b/man/signal_stage.Rd @@ -23,7 +23,8 @@ superseded function.} \code{signal_stage()} allows you to signal life cycle stages other than deprecation (for which you should use \code{\link[=deprecate_warn]{deprecate_warn()}} and friends). There is no behaviour associated with this signal, it is currently purely a way to -express intent at the call site. +express intent at the call site. In the future, we hope to replace this with +a standardized call to \code{base::declare()}. } \examples{ foofy <- function(x, y, z) {