On Wed, Aug 21, 2013 at 3:30 AM, ivo welch <ivo.we...@gmail.com> wrote: > thx, deepayan: how is stopifnot better than > if (!all(...)) stop()
But I am not claiming that it is! If you think it is not useful, then don't use stopifnot(), use stop() instead, and tell your students to do so as well. > given that we have stopifnot() and I have seen it used often, I think > my two suggestions would make it better. Maybe it will (in some specific use cases). But looking at your suggestion purely from the point of view of "is it worth incorporating into base R?", I don't see enough justification. The disadvantage is that it will complicate a simple function. The supposed advantage is only an advantage when you use stopifnot() in a way that was not intended, whereas there is already an alternative that does almost exactly what you want (at least you haven't yet explained why you are not happy with stop()). Interpolated strings may be cool, but I don't see a big readability advantage of if (!is.matrix(m)) stop("m is not a matrix, but a {{class(m)}}") over if (!is.matrix(m)) stop("m is not a matrix, but a ", class(m)) Note that I'm not saying that stop() is perfect or anything, or that there is no need for alternatives. Just that I'm not convinced that the base R changes you want are justified. -Deepayan ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel