[Rd] Behaviour of environment(foo)<- (PR#1509)

J.C.Rougier@durham.ac.uk J.C.Rougier@durham.ac.uk
Fri, 3 May 2002 12:12:12 +0200 (MET DST)


Hi Everyone, 

I've noticed that setting the environment of a function from a package
actually creates a copy of that function in .GlobalEnv and sets the
environment on this copy:

> find(.profile)
[1] "package:newblips"
> environment(.profile) <- bb1$getEnv() # this is an environment
> find(.profile)
[1] ".GlobalEnv"       "package:newblips"

I don't have a problem with this behaviour (now I understand it!) but
I think that it would help to document it in the help file.  May I
suggest that instead of

     The assignment form sets the environment of the function or
     formula `fun' to the `value' given.

we have

     The assignment form sets the environment of the function or
     formula \code{fun} to \code{value} if \code{fun} is in the
     current environment, otherwise it makes a copy of \code{fun} in
     the current environment and sets the environment of the copy.

I think that describes the current procedure: please correct me if I
am wrong!

Cheers, Jonathan.

--please do not edit the information below--

Version:
 platform = i686-pc-linux-gnu
 arch = i686
 os = linux-gnu
 system = i686, linux-gnu
 status = 
 major = 1
 minor = 5.0
 year = 2002
 month = 04
 day = 29
 language = R

Search Path:
 .GlobalEnv, package:newblips, package:MASS, package:mva, Autoloads, package:base

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._