3 ms·
A common use case for the sum type is to define a Result (or Either) type. Now, C# not having checked exceptions is not as much in need for one as Java is, but
by weinzierl 5mo ago
A common use case for the sum type is to define a Result (or Either) type. Now, C# not having checked exceptions is not as much in need for one as Java is, but I could still
imagine it being useful for stream
like constructs.
- Quarrelsome 5mo agoyeah this is the one I've considered as being mildly compelling. But don't we lose the fun of having exception handling as separate to the happy path?
- exkgkkwksk 5mo agooo and support for exceptions, in particular checked exceptions, was a mistake of the 90s. We know better today, there’s a reason for why modern languages like go/rust/swift don’t use them, and why many use c++ with exceptions disabled.
- vips7L 5mo agoChecked exceptions are great. There is no difference between them and results/unions except syntax. The below all express the same thing. Swift in fact uses the checked throws syntax. Result<T,E> fn() T | E fn() T fn() throws E fn() throws(E) -> T