From p.dalgaard at biostat.ku.dk  Tue Apr 20 20:59:22 2004
From: p.dalgaard at biostat.ku.dk (Peter Dalgaard)
Date: Tue Apr 20 21:02:48 2004
Subject: [Rd] Re: [R] Error message during debug (PR#6804)
In-Reply-To: <20040420181543.A86F110478@slim.kubism.ku.dk>
References: <20040420181543.A86F110478@slim.kubism.ku.dk>
Message-ID: <x2y8oqfpbp.fsf@biostat.ku.dk>

dmurdoch@pair.com writes:

> On Tue, 20 Apr 2004 13:48:43 -0400 (EDT), "Gabor Grothendieck"
> <ggrothendieck@myway.com> wrote :
> 
> >
> >In R 1.9.0 on Windows XP Pro I get an error if I try to
> >debug the identity function f shown:
> >
> > > f <- function(x)x
> > > debug(f)
> > > f(1)
> > debugging in: f(1)
> > Error in f(1) : Unimplemented feature in eval
> > > R.version.string
> > [1] "R version 1.9.0, 2004-04-12"
> >
> >Without debuggging its ok.
> 
> Confirmed.  It's not new in 1.9.0, it appears in 1.8.1 as well.  It
> seems that a function body consisting of a single token triggers it.
> I get a crash from this variation:
> 
> f <- function(x) 4
> 
> Maybe the system is trying to tell us that functions this simple don't
> need debugging? ;-)
> 
> I'm sending this message to r-bugs to get it into the bug list (but I
> won't have time to look at it until at least the weekend, if someone
> else wants to fix it).

Actually, ?debug says:

                             Currently you can only debug functions
     that have bodies enclosed in braces. This is a bug and will be
     fixed soon.

(and has probably said so for a very long time....)

I hadn't seen the segfault from debugging a constant before, but I
recently discovered that you *can* (sort of) debug a single-expression
function by setting options(error=recover).

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907


[Rd] Re: [R] Error message during debug (PR#6804)
Peter Dalgaard