Re: [Rd] Trying to understand the search path and namespaces

From: Hadley Wickham <hadley_at_rice.edu>
Date: Mon, 15 Nov 2010 18:51:09 -0600

> With a small risk of being incorrect (and the chance of learning
> something new), I'll give it a try:
>
> A search for a functions/objects/... that is not in the same package
> environment is done in the order that the search() path gives.  The
> exception to this iff your package has a namespace, then the 'base'
> package environment is always searched first (before any other
> environments).  The ordering of the search is important when there
> exist multiple package environments with the same function.
>
> Is that of any help?

Well, that's what I thought too. But:

parents <- function(x) {
  if (identical(x, emptyenv())) return()   c(environmentName(x), parents(parent.env(x))) }
> parents(as.environment("package:devtools"))
[1] "package:devtools" "package:methods" "Autoloads" "base"

And package:testthat isn't listed there. (But Autoloads is suggestive...)

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Tue 16 Nov 2010 - 01:06:17 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 16 Nov 2010 - 01:50:22 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive