From mtmorgan at fhcrc.org  Mon Nov 22 17:34:28 2010
From: mtmorgan at fhcrc.org (Martin Morgan)
Date: Mon, 22 Nov 2010 08:34:28 -0800
Subject: [Rd] S4 setMethod, setGeneric and default arguments
In-Reply-To: <1290424990027-3053442.post@n4.nabble.com>
References: <1289477631441-3037716.post@n4.nabble.com>
	<1290424990027-3053442.post@n4.nabble.com>
Message-ID: <4CEA9B94.3070407@fhcrc.org>

On 11/22/2010 03:23 AM, evilphil wrote:
> 
> <BUMP>
> 
> anyone?

Hi evilphil --

Your method signature doesn't have 'missing' for its third argument, and
hence isn't the target of dispatch when the generic is invoked with a
missing argument. I guess you'd figured that out and are really asking
whether it's consistent with the S4 design, and I think it is.

Why one might provide a default to an argument that is also dispatched
on seems like a design decision on your part. Maybe because missing
argument dispatch is a common (default) use case? Or to advertise via
the generic args what a typical value might be? But dispatch on multiple
arguments becomes complicated -- the number of combinations of possible
arguments is large, the 'next' method very difficult to reason about --
so might best be avoided if not necessary. The 'signature' argument of
setGeneric allows arguments to be included but not dispatched on.

Martin
-- 
Computational Biology
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109

Location: M1-B861
Telephone: 206 667-2793



[Rd] S4 setMethod, setGeneric and default arguments
Martin Morgan