Re: [Rd] S4 dispatch for .DollarNames (utils)

2010-05-30 Thread Claudia Beleites
Dear all, thank your for this discussion - I had been wondering how to get the completion with my S4 class, but it didn't bother me enough to dig into things. The workaround/hack that *does* work now, I believe, is to insert a dummy S3 class into the mix and define the S3 .DollarNames method

Re: [Rd] S4 dispatch for .DollarNames (utils)

2010-05-30 Thread John Chambers
Claudia, Your S3 methods will be selected for objects from hyperSpec, but not for S4 classes that inherit from that class (that have contains=hyperSpec in their definition). The S3 method dispatch has been fixed to recognize S4 classes that inherit from an S3 class, foo3 in my example.

Re: [Rd] S4 dispatch for .DollarNames (utils)

2010-05-30 Thread Claudia Beleites
John, Thank your for the explanation! Claudia -- Claudia Beleites Dipartimento dei Materiali e delle Risorse Naturali Università degli Studi di Trieste Via Alfonso Valerio 6/a I-34127 Trieste phone: +39 0 40 5 58-37 68 email: cbelei...@units.it __

[Rd] S4 dispatch for .DollarNames (utils)

2010-05-29 Thread Romain Francois
Hello, I'm trying to make .DollarNames generic and implement a method for it in a package. .DollarNames is the function that is now called to get completion possibilities. My R code looks like this: setGeneric( .DollarNames ) setClass(track, representation(x=numeric, y=numeric))

Re: [Rd] S4 dispatch for .DollarNames (utils)

2010-05-29 Thread Romain Francois
This seems to do the trick, but it does not feel right: .onLoad - function( libname, pkgname ){ utils - asNamespace( utils ) unlockBinding( .DollarNames, utils ) assignInNamespace( .DollarNames, .DollarNames, utils ) lockBinding( .DollarNames, utils ) } Any

Re: [Rd] S4 dispatch for .DollarNames (utils)

2010-05-29 Thread Deepayan Sarkar
On Sat, May 29, 2010 at 4:21 AM, Romain Francois rom...@r-enthusiasts.com wrote: Hello, I'm trying to make .DollarNames generic and implement a method for it in a package. .DollarNames is the function that is now called to get completion possibilities. My R code looks like this:

Re: [Rd] S4 dispatch for .DollarNames (utils)

2010-05-29 Thread Romain Francois
Le 29/05/10 20:23, Deepayan Sarkar a écrit : On Sat, May 29, 2010 at 4:21 AM, Romain Francois rom...@r-enthusiasts.com wrote: Hello, I'm trying to make .DollarNames generic and implement a method for it in a package. .DollarNames is the function that is now called to get completion

Re: [Rd] S4 dispatch for .DollarNames (utils)

2010-05-29 Thread John Chambers
The idea of modifying .DollarNames to recognize S4 methods is OK, but the problem could arise again. It would be better to have a general solution. The general problem as it seems is that an S3 generic called from within its package's namespace (or from some other 3rd package) will not detect

Re: [Rd] S4 dispatch for .DollarNames (utils)

2010-05-29 Thread Romain Francois
Thanks. I'll apply the nice workaround for now. Romain Le 29/05/10 23:15, John Chambers a écrit : The idea of modifying .DollarNames to recognize S4 methods is OK, but the problem could arise again. It would be better to have a general solution. The general problem as it seems is that an S3