You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Analogously to how you can produce debug messages using:
"!DEBUG Hello world: x = `x`"
I'd like to run assertion statements that have near-zero overhead, e.g.
"!ASSERT 'x' is integer `stopifnot(is.integer(x))`"
This will allow package developers to add lots of internal assertions validating not only the contract of returned values, but also intermediate values.
The above could be achieved by
"!DEBUG `stopifnot(is.integer(x))`"
but the downside is that this will also trigger lots of DEBUG-produced output if such exists. Not only may such output clutter troubleshooting but it may also have side effects conflicting with any troubleshooting efforts, e.g. in a DEBUG statement may touch a promise (think "delayed assignment") causing different results than when disabled.
Any assert framework should be supported, so it should not be hard coded to stopifnot() [which comes with even more overhead in R (>= 3.5.0)], assertthat, checkmate, ...
The text was updated successfully, but these errors were encountered:
(continuation of my Tweet https://twitter.com/henrikbengtsson/status/984323561656483841)
Analogously to how you can produce debug messages using:
"!DEBUG Hello world: x = `x`"
I'd like to run assertion statements that have near-zero overhead, e.g.
"!ASSERT 'x' is integer `stopifnot(is.integer(x))`"
This will allow package developers to add lots of internal assertions validating not only the contract of returned values, but also intermediate values.
The above could be achieved by
"!DEBUG `stopifnot(is.integer(x))`"
but the downside is that this will also trigger lots of
DEBUG
-produced output if such exists. Not only may such output clutter troubleshooting but it may also have side effects conflicting with any troubleshooting efforts, e.g. in aDEBUG
statement may touch a promise (think "delayed assignment") causing different results than when disabled.Any assert framework should be supported, so it should not be hard coded to
stopifnot()
[which comes with even more overhead in R (>= 3.5.0)], assertthat, checkmate, ...The text was updated successfully, but these errors were encountered: