From hpages at fhcrc.org  Fri Oct 27 20:22:08 2006
From: hpages at fhcrc.org (Herve Pages)
Date: Fri, 27 Oct 2006 11:22:08 -0700
Subject: [Rd] Pb with .findInheritedMethods
In-Reply-To: <454204C3.2030606@r-project.org>
References: <454142C1.9030809@fhcrc.org> <45415AB4.3050505@fhcrc.org>
	<454204C3.2030606@r-project.org>
Message-ID: <45424E50.8030206@fhcrc.org>

Hi John,


John Chambers wrote:
> A problem with callNextMethod, which is caching an inherited method as
> if it was not inherited, causing confusion on the next search.  Should
> be fairly easy to fix, but may be a while before I get time to do so.
>
> By the way, I hope your simplified example does not reflect what
> happens in the actual one.
>    callNextMethod(.Object)
> throws away all the ... arguments to new(), which rather defeats the
> purpose of having initialize() methods.  Generally, callNextMethod()
> should get no arguments or all the arguments it needs, including ...
> See ?callNextMethod

Thanks for looking at this!

Yes it is a simplified version of a real case and
here .Object is all what callNextMethod() needs because
the initialize method for an "A" object takes no argument
other than .Object

More generally I don't see what's wrong with not passing
to callNextMethod all the arguments coming from the call
to new:

    setClass("A", representation(toto="integer"))
    setMethod("initialize", "A", function(.Object, toto0) {.Object at toto
    <- as.integer(toto0); .Object})
    new("A", 45.1)

    setClass("Ab", contains="A")
    setMethod("initialize", "Ab", function(.Object, x, y)
    callNextMethod(.Object, x*y+1))
    new("Ab", 5, 2)


Regards,

H.




[Rd] Pb with .findInheritedMethods
Herve Pages