No, not a bug.
Inherited methods are never cached until they are needed, for rather
obvious efficiency reasons. See ?showMethods, under argument inherited
If what you were trying to do was find out what method would be called
for class "B" without calling it, use selectMethod().
Seth Falcon wrote:> showMethods isn't reporting inherited methods when it is first
> called. The methods are there and after calling them, showMethods
> gives the right output.
>
> Here is an example (using R-devel r39647):
>
> setClass("A", representation(x="numeric"),
> prototype=list(x=1))
>
> setClass("B", contains="A",
> prototype=list(x=2))
>
> setMethod("initialize", "A",
> function(.Object) {
> cat("In A's init\n")
> .Object at x <- .Object at x + 1
> .Object
> })
>
> setMethod("show", "A",
> function(object) cat("An A like thing. x =", object at
x, "\n"))
>
> showMethods(classes="B") ## should give output, but doesn't
> showMethods(classes="A")
>
> aa <- new("A")
> bb <- new("B")
>
> aa
> bb
>
> ## Now it will give output
> showMethods(classes="B")
>
>
>
>
> --
> + seth
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>