I want to define a tripartite `Result` type which represents success, expected failure and unexpected failure (not for the first time I've tried but I have union types now!). It would be nice if I could find three equal-length words which convey these concepts. Which do you like?
-
-
-
Replying to @gabro27
Do you think that reuse of names that are used for `Try` would be a problem? I also considered `Right`, but didn't want to conflict with `Either`...
3 replies 0 retweets 0 likes -
Replying to @propensive @gabro27
Scope them in the sum type's companion object: Result.Success, Result.Failure... Removes the ambiguity when necessary, and people can always `import Result._` if they don't think there is an ambiguity to remove.
1 reply 0 retweets 1 like -
Replying to @NicolasRinaudo @gabro27
I think I can make it an enum, so it will be that way anyway. :)
1 reply 0 retweets 0 likes -
Replying to @propensive @gabro27
Ah, yes, Scala 3, sorry :) But then where do union types come into play? for the types of the errors themselves?
1 reply 0 retweets 0 likes
Yes, for the types for the anticipated exceptions, so as to set users' expectations about what needs to be handled.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.