[R] Debug problem
Gabor Grothendieck
ggrothendieck at myway.com
Wed Apr 21 02:47:55 CEST 2004
Thomas Lumley <tlumley <at> u.washington.edu> writes:
: On Tue, 20 Apr 2004, Gabor Grothendieck wrote:
: > Consider the following R session under Windows XP Pro. Note that
: > if we set debugging for function
: > f then even if we reset its environment it still has debugging on.
: > Also if we copy f to g then g has debugging; however, if we change
: > g's environment then g no longer has debugging. Why did f retain
: > debugging when its environment was changed but g did not?
:
: My guess, which could be verified by careful reading of the code, is as
: follows:
:
: - There is a debugging flag on each function object
: - Changing the environment does not change this flag
: - Assigning f to g makes g a reference to the same copy of f
: - Now there are two references to the same function, modifying the
: environment of either one causes copying, and the modified function will
: not have the debugging flag set.
Thanks. Your hypothesis does seem likely. In
g <- f; environment(g) <- new.env()
is there any way that I can automatically set g to have debugging
iff f has it?
More information about the R-help
mailing list