From mtmorgan at fhcrc.org  Mon Dec 17 16:10:48 2012
From: mtmorgan at fhcrc.org (Martin Morgan)
Date: Mon, 17 Dec 2012 07:10:48 -0800
Subject: [Rd] Strange, most probably unjustified,
 codoc mismatch for S4 method with one argument plus '...' (re-try)
In-Reply-To: <50CEDE97.1020706@bioinf.jku.at>
References: <50CAE773.8070004@bioinf.jku.at> <50CC0A1F.6060504@fhcrc.org>
	<50CEDE97.1020706@bioinf.jku.at>
Message-ID: <50CF35F8.7010102@fhcrc.org>

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
> definitions
>
>> setMethod("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



[Rd] Strange, most probably unjustified, codoc mismatch for S4 method with one argument plus '...' (re-try)
Martin Morgan