▲ | wesselbindt 2 days ago | |||||||
Right, I understand. But my question is, how do you _ensure_ a failure value is dealt with by clients? In purely functional languages, your clients have no choice, they'll have to do something with it. In imperative languages, they can just ignore it. | ||||||||
▲ | tubthumper8 2 days ago | parent | next [-] | |||||||
In Rust, there's a `#[must_use]` attribute that can be applied to types, such as Result, and on functions. This triggers if the return value is not used. It's only a warning though, but you could imagine a hypothetical imperative language making this a hard error | ||||||||
| ||||||||
▲ | galaxyLogic 2 days ago | parent | prev [-] | |||||||
Failing to detect a result as error-value is a good failure case to be aware of. But I think if you throw an error it is also possible for a client to fail to handle it properly. No Silver Bullet. |