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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to