The challenge is to have a flexible UI that still makes it easy to supply the metadata stored in the warning conditions, that is package, function name, and argument name.
One way to go about this is to allow a length-2 vector whose first element defines the metadata, and the second specifies a warning message.
deprecate_warn(
"1.0.0",
c("pkg::foo(bar)", message = "Supplying `bar = \"none\"` is deprecated.")
)
#> Warning message:
#> Supplying `bar = "none"` is deprecated.
We could use ... as a placeholder that lifecycle could fill in with generated contents.
deprecate_warn(
"1.0.0",
c("pkg::foo(bar)", message = "Supplying `bar = \"none\"`...")
)
#> Warning message:
#> Supplying `bar = "none"` is deprecated as of pkg 1.0.0.
deprecate_warn(
"1.0.0",
c("pkg::foo(bar)", message = "... can no longer be \"none\"...")
)
#> Warning message:
#> The `bar` argument of `foo()` can no longer be "none" as of pkg 1.0.0.
The with argument would also allow a message field:
deprecate_warn(
"1.0.0",
what = c("pkg::foo(bar)", message = "Supplying `bar = \"none\"`..."),
with = c(message = "Please use `bar = NULL` instead.")
)
#> Warning message:
#> Supplying `bar = "none"` is deprecated as of pkg 1.0.0.
#> Please use `bar = NULL` instead.
I like that this leverages existing syntax for defining a deprecation message + metadata.
What do you think @hadley?
The challenge is to have a flexible UI that still makes it easy to supply the metadata stored in the warning conditions, that is package, function name, and argument name.
One way to go about this is to allow a length-2 vector whose first element defines the metadata, and the second specifies a warning message.
We could use
...as a placeholder that lifecycle could fill in with generated contents.The
withargument would also allow amessagefield:I like that this leverages existing syntax for defining a deprecation message + metadata.
What do you think @hadley?