News for hackers. Stuff that matters.
Re:Go and Simplicity Debt Redux by TheDong on Sunday June 18, 2017 @07:26PM (#14583583)
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.

There are no comments on this comment yet.