Re: [R-pkg-devel] slightly polemic question re R CMD check

2020-03-08 Thread David Hugh-Jones
I see the logic, but it seems in practice people often write specific methods with their own specific arguments. (Think of the many plot or print methods for different objects, for example.) Here, enforcing a ... argument does not buy us much. All that we really need is that plot(x) will work for m

Re: [R-pkg-devel] slightly polemic question re R CMD check

2020-03-08 Thread Jeff Newmiller
... also, the only reason non-generic functions using ellipsis can throw an error when an argument is not used is that they keep passing ... on to functions that recursively encounter fumctions that eventually do not accept an ellipsis argument. If the function calls a generic with an ellipsis a

Re: [R-pkg-devel] slightly polemic question re R CMD check

2020-03-08 Thread Jeff Newmiller
R encourages the use of ... particularly in S3 generics, to avoid over-depending on inheritance to enable flexible use of these generics. That is, when you call the generic without knowing which class you are giving it, you cannot specify class-specific arguments. However, some methods have obvi

Re: [R-pkg-devel] slightly polemic question re R CMD check

2020-03-08 Thread David Hugh-Jones
Hi Jeff, I wouldn't say R encourages that in general. Non-generic functions will throw an error if you use a non-existent argument. And some generic functions check for it: seq(1, 3, blah = 1) [1] 1 2 3 Warning message: In seq.default(1, 3, blah = 1) : extra argument ‘blah’ will be disregarded

Re: [R-pkg-devel] slightly polemic question re R CMD check

2020-03-08 Thread Jeff Newmiller
You seem to think this is a bad thing. R does encourage lenient argument checking... what rock have you been under for the last 20 years? On March 8, 2020 5:41:51 AM PDT, David Hugh-Jones wrote: >You're quite right :-) But I think the polemic still holds, because I >have >to add manual argument

Re: [R-pkg-devel] slightly polemic question re R CMD check

2020-03-08 Thread David Hugh-Jones
You're quite right :-) But I think the polemic still holds, because I have to add manual argument checking to all my methods, which has a cost in lines of code. Indeed, few base R methods have chosen to do this. In effect, the current setup encourages writing methods with "lenient" argument specifi

Re: [R-pkg-devel] slightly polemic question re R CMD check

2020-03-08 Thread Gábor Csárdi
You can add the ... argument to chop.default(), and then check that length(list(...)) is zero. Also, you might be interested in the ellipsis package. Gabor On Sun, Mar 8, 2020 at 10:56 AM David Hugh-Jones wrote: > > Hi all, > > My package defines the following method and generic: > > chop <- fu

[R-pkg-devel] slightly polemic question re R CMD check

2020-03-08 Thread David Hugh-Jones
Hi all, My package defines the following method and generic: chop <- function (x, ...) UseMethod("chop") chop.default <- function (x, breaks, labels, extend = NULL, drop = TRUE) { ... } R CMD check then gives a warning: W checking S3 generic/method consistency (695ms) chop: function(x