An english language quesion

How do you actually say aloud generic types like Result<T, E> in English?

Is it "Result of T and E"?

I personally say "result of t and e", but for unary type constructors I just say "option t"; on the other hand, I also might say "result t", ignoring the error type.

2 Likes

Usually the error type is not important so I agree with "result T". For example str::parse::<u32> returns a "result u32".

Where the error type is well-known, I may name it as a modifier of the result type. For example Read::read returns an "IO result usize" and serde_json::from_str returns a "JSON result T".

In the rare case that the error type is relevant to my point, I name it more explicitly than the suggestions so far. For example str::from_utf8 returns a "result str slice with a UTF-8 error".

3 Likes

I say it like @ubsan + when I omit the error I usually say something "returns a String result"

1 Like