Closed Bisaloo closed 4 years ago
"> We already talked a bit about this but my main issue is with the stop2()
function."
I thought you did not like it out of principle that a stop() should be a stop() and i thought this was easy enough, and the 'early return' solution cannot be implemented, I don't think, in stand-alone function for the return will just affect that stop2() function, not teh one calling it.
So sure, let's go with the solution you propose to prevent "Error" appearing when it's not expected.
When it is not possible to mke the NULL invisible, i prefer having the error message show up that [1] NULL
Okay, this was a bit tricky but I found a clean way to do this. We can define an exit()
function for this:
exit <- function() {
invokeRestart("abort")
}
test <- function() {
message("this is the last message")
exit()
message("you should not see this")
}
test()
nested_test <- function() {
test()
message("you should not see this either")
}
nested_test()
Great solution. Just tested successfully on R-3.0.1
@urisohn, I added some comments (some for me, some for you). Could you have a look please? I'll try to do the necessary changes in the next days.