rbitrary
rbitrary copied to clipboard
The real, underlying, fundamental, philosophical problem with library and require
The problem is function proliferation for arbitrary reasons. library
and require
pretty much do the same thing. If one exists the other shouldn't. Alternatively, we could have for any function that can fail two versions, one that throws an exception and the other that returns false. Even if you limit this to functions that don't need to return anything else --- say that excludes sum
or sqrt
, it's a lot of functions. The correct solution is that if you don't want a function that can fail to take down the whole program you can wrap it in a tryCatch
call or equivalent. That's the correct solution because 1) You don't need to duplicate so many functions 2) You get exactly the same flexibility. For additional discussion of function proliferation and cavalier choice of return values and names, see also A critical look at the anyNA function.