[go-nuts] Re: [ generics] Moving forward with the generics design draft

2020-09-04 Thread tdakkota
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

Re: [go-nuts] [generics] type list should not pass newtypes

2020-06-28 Thread tdakkota
июня 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 implement Lesser/Min/etc interface. It

Re: [go-nuts] [generics] type list should not pass newtypes

2020-06-27 Thread tdakkota
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