It really depends on type of code. E.g. if I’m doi...
# stdlib
o
It really depends on type of code. E.g. if I’m doing some throw-away command line program, I don’t want to care about nulls and exception, just let it die with a stacktrace. In other cases, e.g. in protocols, incorrect number in a stream is an “exceptional” situation and better be handled as such. You will have to use
!!
way too often, and do not even see the number that it couldn’t parse. On the other hand, when handling user input, it could be nice to have nullable variant, so that you can fail gracefully, with some default, or better exception, or something. Too bad actual NumberFormatException doesn’t give us the reason of failure, so it’s not suitable for user feedback.
👍 1