3 ms·
Multiple return is almost always used as an optional/either type construct. If you have a type for Some | None, then the return type of maps/chans/etc of (T, b
by TheDong 9y ago
Multiple return is almost always used as an optional/either type construct.
If you have a type for Some | None, then the return type of maps/chans/etc of (T, bool) aren't needed.
Similarly, the (T, err) returns can be replaced by a T | error sum type.
Sometimes multiple returns are used in other cases, but returning a struct covers those, or proper tuples where the value you return is a tuple.
I'm just claiming that multiple return is 90% of the time being used to patch over the lack of proper optional or either types.