3 ms·
There is actually a proposal to make type constraints act as sum types: https://github.com/golang/go/issues/57644 https://github.com/golang/go/issues/57644 But
by tapirl 2y ago
There is actually a proposal to make type constraints act as sum types: https://github.com/golang/go/issues/57644 https://github.com/golang/go/issues/57644
But I doubt sum types will be supported perfectly in Go. The current poor-men's sum type mechanism (type-switch syntax) might be still useful in future Go custom generic age.
- jerf 2y agoI've pondered the utility of just proposing some syntax sugar around the current methodology, mostly for the reason of getting it rejected for being an unnecessary redundancy to what we already have, so we can point at the rejection.