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

Comments

@maxheld83
Copy link
Member

@maxheld83 maxheld83 commented Jul 31, 2018

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

@pllittle pllittle commented Oct 18, 2018

@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

@gustavdelius gustavdelius commented Mar 26, 2019

@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

@gustavdelius gustavdelius commented Mar 26, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants