[Rd] S4 dispatch and S3 "connection" objects

From: Romain Francois <romain.francois_at_dbmail.com>
Date: Tue, 15 Dec 2009 08:36:46 +0100


Hello,

I'm trying to get S4 dispatch on S3 "connection" objects.

So I do :

setOldClass( "connection" )

and then :

setGeneric( "bling", function(object) standardGeneric( "bling" ) ) setMethod( "bling", "connection", function(object) cat( "gotcha ", as.integer(object), "\n" ) )

but I get :

f <- file( "blabla", open = "rb" )

> bling( f )

Error in function (classes, fdef, mtable) :

   unable to find an inherited method for function "bling", for signature "file"
> class( f )

[1] "file" "connection"

Am I supposed to do :

setOldClass( c("file", "connection" ) )
setOldClass( c("url", "connection" ) )

and so on for each potential S3 class, or is there another way.

Romain

-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/HlX9 : new package : bibtex
|- http://tr.im/Gq7i : ohloh
`- http://tr.im/FtUu : new package : highlight

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Tue 15 Dec 2009 - 08:04:48 GMT

This archive was generated by hypermail 2.2.0 : Tue 15 Dec 2009 - 16:11:05 GMT