[Rd] Methods package: One of those strategy questions
John Chambers
jmc@research.bell-labs.com
Tue, 13 Nov 2001 09:54:02 -0500
I had better mention this one separately, since until it's settled you
need a workaround.
If you define methods for primitives now, this does NOT create an
explicit generic function for, say, "[", so that the original primitive
computations still run.
This means that the method dispatch has to be turned on for that
function somehow else.
The proposal is that the library() and attach() functions would do a
check for methods metadata and turn on methods search for the functions
found. (Recent changes to the metadata make this a reasonably efficient
operation.)
Until this is implemented, you will need to force the same computation
from the .First.lib function in your package (ONLY needed if you have
methods for primitives).
The code needed is something like this (inside .First.lib, which gets a
second argument "pkgname":
where <- match(paste("package:", pkgname, sep=""), search())
cacheMetaData(as.environment(where))
(Extra calls to cacheMetaData shouldn't hurt, beyond a moderate bit of
extra computation, so this should not be a disaster even after
modifications to library()).
John
--
John M. Chambers jmc@bell-labs.com
Bell Labs, Lucent Technologies office: (908)582-2681
700 Mountain Avenue, Room 2C-282 fax: (908)582-3340
Murray Hill, NJ 07974 web: http://www.cs.bell-labs.com/~jmc
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._