[Rd] Undefined (so far as I can tell?) behavior of browser when called at top level of sourced script?
g@bembecker @end|ng |rom gm@||@com
Tue Mar 16 22:04:38 CET 2021
I was asked a question about why browser() was behaving a specific way, and
it turned out that it was being called in a script (rather than in a
Putting aside the design considerations that lead to that, the behavior is
actually a bit puzzling, and so far as I have been able to see, completely
undocumented. My suspicion is that this behavior should be considered
undefined, but I wanted to make sure I wasn't missing something. (To be
perfectly honest I was a bit surprised it wasn't an error).
Some experimentation (done in 4.0.1 because that is what I have available,
R script attached) has lead me to conclude that if browser is called at the
top level, 'n' will just continue to the end, *except* in the case where
the next expression is a conditional ** which has a consequent that is
evaluated** or a loop, in which case it walks through the consequent/loop
body however many number of times and then the 'n' that steps out of that
Should something be added to the documentation that either describes this
behavior, declares explicitly that using browser at the top level leads to
undefined behavior, or both?
I can prepare a patch to that effect if desired.
More information about the R-devel