I'd like to see sum types in Go2 and there are many reasons:
- It can make using oneOf/anyOf in protobuf or swagger mush easier.
- It can make ast.Node type-safe.
- With sum-types compiler known maximum size of variant, so it can be
allocated on stack, not on heap.
But I don't think that using
rInt/etc.`
воскресенье, 28 июня 2020 г. в 06:13:31 UTC+3, Ian Lance Taylor:
> On Sat, Jun 27, 2020 at 3:06 PM tdakkota wrote:
> >
> > I think, if I want int/[]int, I should use int/[]int or just declare a
> domain specific alias.
> > MyInt/[]MyInt should implemen
I think, if I want int/[]int, I should use int/[]int or just declare a
domain specific alias.
MyInt/[]MyInt should implement Lesser/Min/etc interface. It can declare
specific comparison rules.
Min implementation can be like: https://go2goplay.golang.org/p/Fgo2fJAlKXD
(this code does not compile