On 12/17/2012 12:57 AM, Ulrich Bodenhofer wrote:
On 12/15/2012 06:26 AM, Martin Morgan wrote:In ?setMethod there is this paragraph It is possible to have some differences between the formal arguments to a method supplied to 'setMethod' and those of the generic. 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'. (What and in practice the expectation is that if a generic has formals x, y, and ..., then a method will have formals x, y, and possibly additional arguments.Thank you very much for your detailed and very helpful reply, Martin! I now understand that all formal arguments of the generic should be included in the list of arguments of methods even if one of them is not needed. My rationale - obviously, I had not looked into the docu well enough - was that I need not declare arguments that were not used in the function body anyway. Since I have not gotten a warning so far (until I experienced the case in my initial posting), I thought this was right. So, am I right that the problem is rather that the first and third of the definitionssetMethod("dummyMethod", signature(x="matrix", y="missing"), function(x) {}) setMethod("dummyMethod", signature(x="data.frame", y="missing"), function(x, ...) {}) setMethod("dummyMethod", signature(x="list", y="missing"), function(x, sel=NULL, ...) {})do NOT result in a warning although they are not correct either while the second one correctly results in a warning?
I think they should all generate an error when setMethod is called. Martin
Thanks and best regards, Ulrich
-- Computational Biology / Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: Arnold Building M1 B861 Phone: (206) 667-2793 ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
