[Rd] Am I missing something about debugging?

Duncan Murdoch murdoch at stats.uwo.ca
Wed Jan 3 00:44:22 CET 2007

On 1/2/2007 5:46 PM, Ross Boylan wrote:
> On Tue, 2007-01-02 at 17:24 -0500, Duncan Murdoch wrote:
>> I don't think you're missing anything with the debug() function. It 
>> needs updating.
> Bummer!
>> I don't think there's any structural reason why you shouldn't be able to 
>> do the things you're talking about in R, but they haven't been 
>> implemented.
> That's good to know.  I was wondering if the lexical scoping was
> complicating things.  At least the way I think of it, every call has two
> sets of (potentially) nested environments: the lexical scopes of the
> function definition and the dynamic scopes of the call.  But since the
> dynamic scopes are available, using them seems possible.

I wouldn't call the dynamic scopes "nested", more like "chained".  If a 
search fails in one of them, it never looks in the next one:  only the 
lexical scope nesting does that.
>> Mark Bravington put together a package (called debug) that does more 
>> than debug() does, but I haven't used it much, and I don't know if it 
>> does what you want.
> It looked to me as if it was some help, but no advance on the
> investigating dynamic frames front.
>> I recently added things to the R parser to keep track of connections 
>> between R code and source files; that was partly meant as a first step 
>> towards improving the debugging facilities.  I'd be happy to help anyone 
>> who wants to do the hard work, but I don't think I'll be able to work on 
>> it before next summer.  (If you do decide to work on it, please let me 
>> know, just in case I do get a chance:  no point duplicating effort.)
> I didn't even realize such a facility was needed, which shows how much I
> know!  Working on the debugger is probably not in my job description,
> unless I get really annoyed.
> The smalltalk debugger is the standard by which I judge all others; it's
> just amazing.  You can go up and down the stack, graphically examine
> variables (and follow links), and change code in the middle of debugging
> and then continue.

Everything except the "change code" part is pretty standard in a modern 
debugger; I'd hope an R debugger could do them.  An interpreter like R 
could allow changes, but I'm not sure what the user interface would look 

Duncan Murdoch

More information about the R-devel mailing list