2 ms·
There are two common ways to deal with failable operations: either throw/panic/abort instead of returning a value if creating the value fails, or return a conta
by DougBTX 4y ago
There are two common ways to deal with failable operations: either throw/panic/abort instead of returning a value if creating the value fails, or return a container which must be checked for success before the value can be accessed.
The key is that once a value has definitely been obtained, the compiler needs to be able to track that, otherwise it is unclear whether the value needs to be checked again whenever it is used. Often those checks are not where they should be, leading to many bugs.