Re: [Rd] calling setGeneric() twice

From: Seth Falcon <seth_at_userprimary.net>
Date: Tue, 19 Jan 2010 10:05:16 -0800

On 1/19/10 10:01 AM, Ross Boylan wrote:
> Is it safe to call setGeneric twice, assuming some setMethod's for the
> target function occur in between? By "safe" I mean that all the
> setMethod's remain in effect, and the 2nd call is, effectively, a no-op.
>
> ?setGeneric says nothing explicit about this behavior that I can see.
> It does say that if there is an existing implicity generic function it
> will be (re?)used. I also tried ?Methods, google and the mailing list
> archives.
>
> I looked at the code for setGeneric, but I'm not confident how it
> behaves. It doesn't seem to do a simple return of the existing value if
> a generic already exists, although it does have special handling for
> that case. The other problem with looking at the code--or running
> tests--is that they only show the current behavior, which might change
> later.
>
> 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.

+ seth

-- 
Seth Falcon | @sfalcon | http://userprimary.net/user

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Tue 19 Jan 2010 - 18:08:33 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 19 Jan 2010 - 21:10:14 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive