Skip to content

allow multiple @inheritDotParams #767

@maxheld83

Description

@maxheld83

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions