From ross at biostat.ucsf.edu  Tue Jan 19 20:19:30 2010
From: ross at biostat.ucsf.edu (Ross Boylan)
Date: Tue, 19 Jan 2010 11:19:30 -0800
Subject: [Rd] calling setGeneric() twice
In-Reply-To: <4B55F45C.4040408@userprimary.net>
References: <1263924060.10417.31.camel@corn.betterworld.us>
	<4B55F45C.4040408@userprimary.net>
Message-ID: <1263928770.10417.52.camel@corn.betterworld.us>

On Tue, 2010-01-19 at 10:05 -0800, Seth Falcon wrote:
> > This came up because of some issues with the sequencing of code in
> my
> > package.  Adding duplicate setGeneric's seems like the smallest, and
> > therefore safest, change if the duplication is not a problem.
> 
> I'm not sure of the answer to your question, but I think it is the
> wrong 
> question :-)
> 
> Perhaps you can provide more detail on why you are using multiple
> calls 
> to setGeneric.  That seems like a very odd thing to do.
My system is defined in a collection of .R files, most of which are
organized around classes.  So the typical file has a setClass(),
setGeneric()'s, and setMethod()'s.

If files that were read in later in the sequence extended an existing
generic, I omitted the setGeneric().

I had to resequence the order in which the files were read to avoid some
"undefined slot classes" warnings.  The resequencing created other
problems, including some cases in which I had a setMethod without a
previous setGeneric.

I have seen the advice to sequence the files so that class definitions,
then generic definitions, and finally function and method definitions
occur.  I am trying not to do that for two reasons.  First, I'm trying
to keep the changes I make small to avoid introducing errors.  Second, I
prefer to keep all the code related to a single class in a single file.

Some of the files were intended for free-standing use, and so it would
be useful if they could retain setGeneric()'s even if I also need an
earlier setGeneric to make the whole package work.

I am also working on a python script to extract all the generic function
defintions (that is, setGeneric()), just in case.

Ross Boylan



[Rd] calling setGeneric() twice
Ross Boylan