From Martin Maechler <maechler@stat.math.ethz.ch>  Wed Aug 20 16:52:53 1997
From: Martin Maechler <maechler@stat.math.ethz.ch> (Martin Maechler)
Date: Wed, 20 Aug 1997 17:52:53 +0200
Subject: R-alpha: R-0.50-a3(+) Method despatching bug ?
Message-ID: <199708201552.RAA02602@sophie.ethz.ch>

It is very wierd...  Can some of you confirm the following behavior ?
It is a new bug (feature ?)  which was not yet in 0.49 ...




noquote <- function(obj) {
	## constructor for a useful "minor" class
	if(!inherits(obj,"noquote")) class(obj) <- c(class(obj),"noquote")
	obj
}
"[.noquote" <- function (x, subs) structure(unclass(x)[subs], class = "noquote")

print.noquote <- function(obj,...) {
	## method for (character) objects of class 'noquote'
	cl <- class(obj)
	class(obj) <- cl[cl != "noquote"]
	NextMethod("print", obj, quote = FALSE, ...)
}

nq <- noquote(letters)

##-- the next two should be equivalent, but are not ...?..
print(nq)
nq

> print(nq)
 [1] a b c d e f g h i j k l m n o p q r s t u v w x y z

> nq
Error: couldn't find function "print.noquote"
> unclass(nq)
 [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s"
[20] "t" "u" "v" "w" "x" "y" "z"
> nq
Error: couldn't find function "print.noquote"
> ls()
[1] "[.noquote"     "noquote"       "nq"            "print.noquote"
> print.noquote
function (obj, ...) 
{
        ## method for (character) objects of class 'noquote'
        cl <- class(obj)
        class(obj) <- cl[cl != "noquote"]
        NextMethod("print", obj, quote = FALSE, ...)
}
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


R-alpha: R-0.50-a3(+) Method despatching bug ?
Martin Maechler