Skip to content
Back to formatted view

Raw Message

Message-ID: <SYBPR01MB4761EF14E10B960F966A6767CD9A9@SYBPR01MB4761.ausprd01.prod.outlook.com>
Date: 2021-11-17T08:00:03Z
From: Dario Strbenac
Subject: [R-pkg-devel] S4 Methods and Ellipsis Formals

Good day,

I read in the documentation of SetMethod that "Roughly, if the generic has ... as one of its arguments, then the method may have extra formal arguments, which will be matched from the arguments matching ... in the call to f." I was hoping that ellipsis could be also part of a method because this explanation doesn't explicitly rule it out. What I am hoping to do is:

setGeneric("Example", function(x, ...) standardGeneric("Example"))
setMethod("Example", "numeric", function(x, y, ...) as.list(...))
Example(x = 1, y = 2, z = 3, a = 99) # Error in typeof(x) : argument "x" is missing, with no default

So, ellipsis can't be a formal of a method, but only in the generic? May this be clarified by the documentation?

--------------------------------------
Dario Strbenac
University of Sydney
Camperdown NSW 2050
Australia