[Rd] name spaces?

Timothy H. Keitt Timothy.Keitt@stonybrook.edu
22 Mar 2002 10:55:11 -0500


I'm revisiting the R/S DBI package and was wondering if there is any
plan to implement package name spaces in R/S. I've taken to the habit of
prepending a few characters to function names in packages to avoid
collisions, e.g., dbConnect(). An alternative would be DBI::connect()
(s/::/preferred/) which in some ways I find more pleasing. Not having
thought about it in detail, it seems pretty simple, except for backward
compatibility. Packages already load function defs into their own
environment. Keeping the name space seperate means simply not adding
that environment to the search path and using the package name as an
index into a name space lookup table, i.e., connect() looks in global
and DBI::connect() looks in the DBI package environment. One could then
have a use(DBI::connect) function that loads 'connect' into the global
name space, and a global option 'use.name.spaces' or something to change
the default behavior. (An alternate approach would be to use
DBI.connect() and add a switch to 'library' or global option that strips
off the 'DBI' prefix.) Anyway, it would help in nailing down the DBI
interface to know if some name space mechanism is in the works.

Cheers,
Tim

-- 
Timothy H. Keitt
Department of Ecology and Evolution
State University of New York at Stony Brook
Stony Brook, New York 11794 USA
Phone: 631-632-1101, FAX: 631-632-7626
http://life.bio.sunysb.edu/ee/keitt/
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._