Skip to content

mysteriously persistent generic definition

5 messages · Ross Boylan, Martin Morgan, Duncan Murdoch

#
Originally I made a function yearStop that took an argument "object".  I
made a generic, but later changed the argument to "x".  R keeps
resurrecting the old definition.  Could anyone explain what is going on,
or how to fix it?  Note particularly the end of the transcript below: I
remove the generic, verify that the symbol is undefined, make a new
function, and then make a generic.  But the generic does not use the
argument of the new function definition.

<quote>
function (obj) 
NULL
function (x) 
NULL
[1] "yearStop"
function (obj) 
NULL
[1] TRUE
Error in args(yearStop) : object "yearStop" not found
[1] "yearStop"
function (obj) 
NULL
</quote>

R 2.7.1.  I originally read the definitions in from a file with ^c^l in
ESS; however, I typed the commands above by hand.

Thanks.
Ross Boylan
#
Ross Boylan wrote:
I don't see this behavior in R-2.9.2, or in the release candidate.

Martin

  
    
5 days later
#
Here's a self-contained example of the problem:
[1] "foo"
[1] TRUE
function (x) 
NULL
[1] "foo"
function (obj) 
NULL

R 2.7.1.  I get the same behavior whether or not I use ESS.

The reason this is more than a theoretical problem:
Error in match.call(fun, fcall) : unused argument(s) (x = "numeric")

Ross
#
R 2.8.1 on Windows behaves as I expected, i.e., the final args(foo)
returns a function of x.  The previous example (below) was on Debian
GNU/Linux.
On Wed, 2009-10-28 at 12:14 -0700, Ross Boylan wrote:
#
On 10/28/2009 3:14 PM, Ross Boylan wrote:
We just released 2.10.0.  It doesn't have this problem, nor does 2.9.2, 
or 2.8.1.  I think you'll just have to upgrade.

Duncan Murdoch