trySilent (was try.Silent)
On Wed, 8 Jan 2003, Kurt Hornik wrote:
writes:
We could, and it had crossed my mind. Thanky ou for raising it. However, we could not do that before 1.7.0 (new feature, and anyway 1.6.2 is in final testing for release in a couple of days).
We have been considering having package methods in the default package list for 1.7.0, which would provide this. However, my preference would be to have this as an argument to try, as in try(..., silent=TRUE) Note that trySilent actually does two things:
i) it sets options(show.error.messages = FALSE) ii) it sets options(error = empty.dump) (or equivalently) to suppress any error handler
and one might just want just one of those two. Do perhaps
try(..., silent = FALSE, nodump= TRUE)
(or defaulting nodump to silent) might be a comprehensive interface.
Any preferences?
[Anticipating Luke's comment, or at least trying to ...] Wouldn't it be better to more generally have a way of executing with options temporarily reset in a 'safe' way, a la withOptions(EXPR, list(show.error.messages = FALSE, ...))
In the (probably not so) longer run we need that; we will also need to think through how try and try(...,silent=TRUE) should work within a more sophisticated error handling system. But I think the simpler interface that allows just try(..., silent=TRUE) is fine and can be implemented in a way that works reasonably now and also later when we have better options management and better error handling. (In writing the documentation we should make sure not to commit to implementation details, just the funtionality.) I would prefer not to add separate control over frame dumping; fine control like that is I think better left to the error handling system. luke
Luke Tierney University of Iowa Phone: 319-335-3386 Department of Statistics and Fax: 319-335-3017 Actuarial Science 241 Schaeffer Hall email: luke@stat.uiowa.edu Iowa City, IA 52242 WWW: http://www.stat.uiowa.edu