Skip to content
Prev 480 / 63424 Next

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

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
[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
Error: couldn't find function "print.noquote"
[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"
Error: couldn't find function "print.noquote"
[1] "[.noquote"     "noquote"       "nq"            "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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-