New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use rlang dots helper instead of ellipsis #6038
Conversation
R/rows.R
Outdated
@@ -186,7 +186,7 @@ rows_upsert.data.frame <- function(x, y, by = NULL, ..., copy = FALSE, in_place | |||
rows_delete <- function(x, y, by = NULL, ..., copy = FALSE, in_place = FALSE) { | |||
# Need action = warn, because methods may have | |||
# side effects that persist even after we abort | |||
ellipsis::check_dots_used(action = warn) | |||
rlang::check_dots_used(action = warn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I plan to deprecate the action =
, maybe wait until that's the case? I'll do it next week.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this not throwing errors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @krlmlr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These methods are unusual in the sense that their main purpose may be the side effects they cause, especially with in_place = TRUE
for database backends. Throwing an error after the side effects happened would be wrong here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm generally in favor of removing the check_dots_*()
helpers from the generics, and letting the methods call check_dots_empty()
, like what @romainfrancois did in dm cynkra/dm#639
The only other place we use check_dots_used()
like this is in pull()
, but we could change that too to make pull.data.frame()
call check_dots_empty()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, perhaps we can do pull()
in a follow up pull request. Although it looks like more methods exist:
https://github.com/search?q=org%3Acran+S3method%28pull%2C&type=code
So perhaps more implementations would have to use check_dots_empty()
yeah for consistency |
Not sure why still getting
|
Ooooh @romainfrancois this was a tough one. It is because we inline Line 53 in 0445420
Found by stepping through It would be great to remove that if we can, I think |
This seems to do the trick. Thanks @DavisVaughan. cc @lionel- in case Perhaps we can use |
We have: rows_insert <- function(x, y, by = NULL, ..., copy = FALSE, in_place = FALSE) {
# Need action = warn, because methods may have
# side effects that persist even after we abort
check_dots_used()
UseMethod("rows_insert")
} and then in rows_insert.tbl_dbi <- function(x, y, by = NULL, ...,
in_place = NULL, copy = FALSE, check = NULL,
returning = NULL) { And the |
…_used() on the generic
Am I understanding this right: if all methods use |
Yeah I guess so, at least in this case where IIUC the generic had If instead, the method checks that the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another potential reason for using check_dots_empty()
in dplyr methods instead of check_dots_used()
in dplyr generics is that the latter can't detect that an argument was defused with {{
or enquo()
.
Perhaps this should drop the
rlang::
prefix too sincerlang
is@import
'ed