Skip to content
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

allow multiple @inheritDotParams #767

Closed
maxheld83 opened this issue Jul 31, 2018 · 3 comments
Closed

allow multiple @inheritDotParams #767

maxheld83 opened this issue Jul 31, 2018 · 3 comments
Labels
feature a feature request or enhancement inherit 👨‍👩‍👧‍👦
Milestone

Comments

@maxheld83
Copy link
Member

thanks so much for #' @inheritDotParams; it's a fantastic addition.

Though I couldn't find documentation for this, it appears that you can currently use only one #' @inheritDotParams per documentation entry.

When, all other things equal, I try to add two such tags for the same function, I get this error message:

Writing NAMESPACE
Error in mapply(FUN = f, ..., SIMPLIFY = FALSE) : 
  zero-length inputs cannot be mixed with those of non-zero length
Calls: suppressPackageStartupMessages ... topics_process_inherit -> <Anonymous> -> fun -> Map -> mapply

Is this a known/intended limitation of #' @inheritDotParams?


My use case is something like this:

#' Do something
#' Does something
#' @param x [`character(1)`] very interesting text.
#' @inheritDotParams lower_level_fun_a -x
#' @inheritDotParams lower_level_fun_b -x
higher_level_fun(x, ...) {
  lower_level_fun_a(x, ...)
  lower_level_fun_b(x, ...)
}
#' Do a
#' Does a
#' @param foo a very fooish character
lower_level_fun_a(x, foo = "zap") {
  print(x, foo)
}
#' Do b
#' Does b
#' @param bar a very booish character
lower_level_fun_b(x, bar = "zong") {
  print(x, zong)
}

I understand that passing on ... to multiple functions is a bit risky, because if arguments carry the same names, they get matched twice (intended here).

But if this seems safe to the dev, multiple #' @inheritDotParams could save a lot of typing.

@pllittle
Copy link

@maxheld83 I've also encountered this issue after multiple attempts to generate Rd files from roxygen. Allowing for multiple inheritDotParams would definitely save on typing time.

@gustavdelius
Copy link
Contributor

@halldc, given that you have that nice pull request #842 for improving inheritDocParams, perhaps you have an idea how to fix this issue?

@gustavdelius
Copy link
Contributor

This error was due to a simple cut-and-paste error in a single line in the code. I have submitted pull request #854 which fixes it.

@hadley hadley added feature a feature request or enhancement inherit 👨‍👩‍👧‍👦 labels Jul 20, 2019
@hadley hadley added this to the v6.2.0 milestone Aug 22, 2019
@hadley hadley closed this as completed in 9bd9f4a Sep 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement inherit 👨‍👩‍👧‍👦
Projects
None yet
Development

No branches or pull requests

4 participants