Merged
Conversation
DavisVaughan
commented
Oct 7, 2025
Member
Author
There was a problem hiding this comment.
Unfortunately git diff thinks this is a "new" file
Comment on lines
+104
to
+124
| 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) | ||
| } |
Member
Author
There was a problem hiding this comment.
I did leave these as officially soft-deprecated
Member
Author
|
Latest commit tries another approach - making This makes it clear that it is purely about expressing intent at the call site. It is also obviously as fast as it gets. library(lifecycle)
bench::mark(
signal_stage("experimental", "this()"),
iterations = 100000
)
#> # A tibble: 1 × 6
#> expression min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 "signal_stage(\"experimental\", \"this()\")" 82ns 205ns 3736394. 0B 0I did mark the arg |
lionel-
approved these changes
Oct 9, 2025
DavisVaughan
commented
Oct 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In #202 we decided to deprecate
signal_stage(), but as we thought more about it, it seems like this:is quite useful for expressing intent at the call site, even if it doesn't do anything.
We've certainly used this in dplyr, purrr, recipes, and ggplot2, and the community has as well:
https://github.com/search?q=%22lifecycle%3A%3Asignal_stage%22+org%3Acran&type=code
So we've decided to keep it after all, with a few tweaks:
The
conditionMessage()method emits"", for maximum performance, since it can't be lazy right now. See inline comment below.We do not use
signal_stage()indeprecate_*()anymore, for max performance. We also think that if we were to do anything with these functions in the future, it would probably be some kind of static analysis, and we could look for bothsignal_stage()anddeprecate_*()call sitesRelated to the above,
"deprecated"is no longer a validstageforsignal_stage(). This was never documented to be valid, it was only used internally. No one seems to have used this.There is no currently exported way to get at the "data" in the condition itself. It is now purely used to express intent at the call site. We can consider adding something in the future if needed, but it seems unlikely.
Remembering that
signal_stage("experimental", ...)will be used in our experimental functions and we don't want a performance penalty there, I'm happy with this performance: