[R] Debug problem
tlumley at u.washington.edu
Wed Apr 21 01:57:01 CEST 2004
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
- 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.
This correctly predicts that after
the debugging flag will be set for g but not f, since f was modified.
More information about the R-help