RE: [Rd] RE: [R] debugging non-visible functions

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Thu 14 Oct 2004 - 00:52:23 EST


On Wed, 13 Oct 2004, Liaw, Andy wrote:

> > From: Duncan Murdoch
> [snip]
> > For 2.1.0, would it be reasonable to extend debug() the way ? was
> > extended? E.g. allow
> >
> > debug(plot(x))
> >
> > and have the debugging flag be set on the appropriate function,
> > whatever and wherever it happens to be? There's some ambiguity with
> > S3 methods (did you want to debug the generic or the method?), but I
> > think defaulting to debugging of the method would be reasonable. (And
> > I think ? needs to be extended to handle S3 methods too, but that's a
> > different question.)
> >
> > Duncan Murdoch
>
> The ambiguity could be quite real. I have a formula method that just does
> preprocessing, then call the default method. What do the debugger do then?
> I've run into situations that I wanted to debug both of them, but not at the
> same time. I just do what Gabor had suggested: debug(namespace:::function).
> Works for me.

However that's not actually the function used for an S3 method.

  1. You can alter namespace:::function and leave the registered method unchanged, and v.v., although we try not to make it easy for you.
  2. In any case, the registered method for predict() of class "foo" need not be namespace:::predict.foo, but might be predictFoo, say. (And you cannot _easily_ find out.)

Trace is another problem child in namespaces: see PR#7091 on R-bugs.

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Thu Oct 14 01:00:16 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:45:21 EST