[Rd] Caching bug with showMethods?
Seth Falcon
sfalcon at fhcrc.org
Wed Oct 18 01:02:15 CEST 2006
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
More information about the R-devel
mailing list