It is fair to have a preference for exceptions. It sounds like there may be a misunderstanding on how Option
works.
Have you used languages that didn’t have null
and had Option
instead? If we look at Rust, you can’t forget not to check it: it is impossible to get the Some
of an Option
without dealing with the None
. You can’t forget this. You can mess up in a lot of other ways, but you explicitly have to decide how to handle that potential None
case.
If you want it to fail fast and obvious, there are ways to do this. For example you, you can use the unwrap()
method to get the contained Some
value or panic if it is None
, expect()
to do the same but with a custom panic message, the ?
operator to get the contained Some
value or return the function with None
, etc. Tangentially, these also work for Result
, which can be Ok
or Err
.
It is pretty common to use these methods in places where you always want to fail somewhere that you don’t expect should have a None
or where you don’t want your code to deal with the consequences of something unexpected. You have decided this and live with the consequences, instead of it implicitly happening/you forgetting to deal with it.
Maybe I’m misunderstanding, but as shown in your link,
$HOME
does not conflict with the XDG Base Directory Specification. It partially relies on$HOME
being defined.