[Rd] Is invokeRestart("abort") unstoppable?

From: Henrik Bengtsson <hb_at_biostat.ucsf.edu>
Date: Tue, 11 Sep 2012 16:19:53 -0700


Hi,

I'm trying to implement an abort() method that works just like stop() but does not signal the condition such that try() and tryCatch(..., condition=...) are, contrary to stop(), effectively non-working with abort() calls.

In order to achieve this, I stumbled upon invokeRestart("abort"), cf. help("invokeRestart", package="base") that reads "Restarts are used for establishing recovery protocols. They can be established using withRestarts. One pre-established restart is an abort restart that represents a jump to top level.".

So, my current implementation is (roughly):

abort <- function(...) {
# handling messages etc

# Fully abort the R evaluation and return to the top level
 invokeRestart("abort")
}

I've tested it in various setups with and without tryCatch(..., condition=...) and so on and it appears to work. Does anyone know if I'm overlooking something or can I count on invokeRestart("abort") to always stop any currently evaluated R code?

Also, does anyone know how far back (in R versions) invokeRestart("abort") goes?

Thxs,

Henrik



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Tue 11 Sep 2012 - 23:23:49 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 12 Sep 2012 - 05:30:41 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive