`finally` and `else` are quite different though. `finally` will run in both
cases, `else` will only run if nothing was actually raised. I agree that `else`
in this case is a useful construct. The `try` block has its own scope, so it's
a bit annoying to have to put lots of code inside a `try` block when it's only
one thing which can throw an exception just because it must be scoped the same.
Of course Nim has implicit returns for any block, so one can do something like:
let myInt =
try: parseInt(s)
except: echo "Error" # Quit, return, or raise here is fine. Otherwise we
need to return a sentinel value we can check against later
Run
One can also wrap these things in options and unpack those (e.g. with my
optionsutils library), but I still think that `else` would be nice to have.