[Rd] does isGeneric work differently in 1.8.0 ?
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Sat Sep 27 22:10:27 MEST 2003
Thomas Stabla <a9265 at stud.uni-bayreuth.de> writes:
> R 1.8.1:
> ---------------------------------------------------
>
> > version
> _
> platform i686-pc-linux-gnu
> arch i686
> os linux-gnu
> system i686, linux-gnu
> status alpha
> major 1
> minor 8.0
> year 2003
> month 09
> day 25
> language R
Did you get that from rsync? (These have the erroneous "alpha"
designation, the tarballs should say "beta" since Wednesday.) If so,
please consider testing the tarball instead since that allows us to
catch packaging errors too.
> > isGeneric("foo")
> [1] FALSE
> > setClass("woo", representation(foo="character"), prototype = list(foo="text"))
> [1] "woo"
> > if(!isGeneric("foo")) setGeneric("foo", function(object) standardGeneric("foo"))
> [1] "foo"
> > setMethod("foo", "woo", function(object) object at foo)
> [1] "foo"
> > isGeneric("foo")
> [1] FALSE
Hmm. This is still in the current sources. Doesn't quite look
deliberate, but it works to use the explicit
> isGeneric("foo",environment())
[1] TRUE
What appears to be happening is that we don't get further than this:
> isGeneric
function (f, where = -1, fdef = NULL, getName = FALSE)
{
if (is.null(fdef)) {
if (identical(where, -1)) {
where <- findFunction(f)
if (length(where) == 0)
return(FALSE)
findFunction(f) goes looking in the topenv(parent.frame()) but topenv
is using parent.env() and that goes through the *lexical* scope I
believe, so we end up looking for "foo" in the methods namespace.
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-devel
mailing list