Skip to content
Back to formatted view

Raw Message

Message-ID: <CAA-ibax5UHAm1VSZyivucy8aX_0DPLkO2SC5_0DPNH3WqBuZ1A@mail.gmail.com>
Date: 2024-03-11T18:20:22Z
From: Diego Hernangómez Herrero
Subject: [R-pkg-devel] R CHECK warning about new S3 generic/method consistency
In-Reply-To: <hV4lx_U-zSXxiV1OTTm0J0FGohychf4_b0vU90KlE0JwYYiK2TZTya9uRLOdsfj9CUDjX4qYp7oF8Nbqwn62M-rFtWC23Ds_eVA_De_ls5g=@proton.me>

Usually when I write a generic I use ? in the definition to allow using
additional arguments in specific methods, see

as_bibentry <- function(x, ...) { UseMethod("as_bibentry")
 }

as_bibentry.cff <- function(x, ..., what = c("preferred", "references",
"all")) {

<code>
}

but in any case the method must include at least the arguments defined in
the same order. Using ? in the generic allows me to include `what` arg with
no WARNINGs.




Have a nice day!


El El lun, 11 mar 2024 a las 19:13, CRAN.r <cran.r at proton.me> escribi?:

> On Monday, March 11th, 2024 at 12:43 PM, Diego Hernang?mez Herrero <
> diego.hernangomezherrero at gmail.com> wrote:
>
> > Shouldn?t you include the y argument also inmyscale.default ? Your
> generic is defining that argument as well.
>
> I assume (hopefully correctly) that methods don't need to include all the
> arguments of the generic. I get the same warning if I use "..." instead of
> y, too.
>

	[[alternative HTML version deleted]]