From becker@g@be @ending from gene@com  Tue May  1 19:05:38 2018
From: becker@g@be @ending from gene@com (Gabe Becker)
Date: Tue, 1 May 2018 10:05:38 -0700
Subject: [Rd] debugonce() functions are not considered as debugged
In-Reply-To: <CABtg=K=Q2k8Qr7uk=XQ2Qa76NWUcG0PmDMseZ37E2RZm4=XqDQ@mail.gmail.com>
References: <CABtg=K=Q2k8Qr7uk=XQ2Qa76NWUcG0PmDMseZ37E2RZm4=XqDQ@mail.gmail.com>
Message-ID: <CAMFmJs=BHa9_f3bB-rsuVq-KOEQ4H9g=70q1H6pdPMOZ9PxvaQ@mail.gmail.com>

Gabor,

Others can speak to the origins of this more directly, but from what I
recall this has been true at least since I was working in this space on the
debugcall stuff a couple years ago. I imagine the reasoning  is what you
would expect: a single bit of course can't tell R both that a function is
debugged AND that it should undebug after the first call.  I don't know of
any R-facing way to check for debugonce status, though its possible I
missed it

That said, it would be possible to alter how the two bits are used so that
debugonce sets both of them, and debug (not once) only sets one, rather
them being treated as mutually exclusive. This would alter the behavior so
that debugonce'ed functions that haven't been called yet are considered
debugged, e.g., by isdebugged.

This would not, strictly speaking, be backwards compatible, but by the very
nature of what debugging means, it would not break any existing script
code. It could, and likely would, effect code implementing GUIs, however.

R-core - is this a patch that you are interested in and would consider
incorporating? If so I can volunteer to work on it.

Best,
~G

On Sat, Apr 28, 2018 at 4:57 AM, G?bor Cs?rdi <csardi.gabor at gmail.com>
wrote:

> debugonce() sets a different flag (RSTEP), and this is not queried by
> isdebugged(), and it is also not unset by undebug().
>
> Is this expected? If yes, is there a way to query and unset the RSTEP flag
> from R code?
>
> ? f <- function() { }
> ? debugonce(f)
> ? isdebugged(f)
> [1] FALSE
>
> ? undebug(f)
> Warning message:
> In undebug(f) : argument is not being debugged
>
> ? f()
> debugging in: f()
> debug at #1: {
> }
> Browse[2]>
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>


-- 
Gabriel Becker, Ph.D
Scientist
Bioinformatics and Computational Biology
Genentech Research

	[[alternative HTML version deleted]]




[Rd] debugonce() functions are not considered as debugged
Gabe Becker