design icon indicating copy to clipboard operation
design copied to clipboard

Never use try()

Open hadley opened this issue 6 years ago • 3 comments

Because of the weird type-instability. Almost always clearer to use tryCatch().

hadley avatar Jun 04 '19 15:06 hadley

Except in examples? I.e. use it for the side effect of displaying an error without causing an error.

lionel- avatar Jun 04 '19 15:06 lionel-

try() being used in examples, but not really being best practice otherwise should maybe be its own case study.

Another instance of this is the frequent use of require() in examples, which often causes people to use it outside of examples inappropriately.

jimhester avatar Jun 04 '19 19:06 jimhester

"When your system for showing realistic usage requires that you show unrealistic usage, it's time to reflect."

jennybc avatar Jun 04 '19 20:06 jennybc