Idiomatic way to express errors without resorting to exceptions

Adnan relay.public.adnan at outlook.com
Sat Feb 29 13:40:11 UTC 2020


On Saturday, 29 February 2020 at 13:03:21 UTC, Sebastiaan Koppe 
wrote:
> On Saturday, 29 February 2020 at 12:50:59 UTC, Adnan wrote:
>> * Option!T from the optional package: Has even worse problem 
>> IMO. Not only it allows None + int but also it returns a `[]`. 
>> This API is not to my liking. You could say well Haskell has 
>> fmap for Optional etc, and I am aware of that, so does Rust 
>> with map etc. But I am talking about basic things: like `+`.
>
> I would argue it is one of its strengths.

Doesn't that pretty much defeat the entire purpose of 
type-guarding a potentially error/absent value?


More information about the Digitalmars-d-learn mailing list