Re: [go-nuts] Re: Generic "nillable" constraint

2022-12-22 Thread Pierre Durand
OK thank you, that confirms what I was thinking. Indeed it's not a common need. I wanted to know if it was possible to rewrite https://pkg.go.dev/github.com/stretchr/testify/assert#Nil with a "nillable" constraint instead of "interface{}". Le jeudi 22 décembre 2022 à 14:43:51 UTC+1, axel.wa...

Re: [go-nuts] Re: Generic "nillable" constraint

2022-12-22 Thread 'Axel Wagner' via golang-nuts
On Thu, Dec 22, 2022 at 2:24 PM Pierre Durand wrote: > Same question for `len()`: is there a way to declare a constraint that > matches types that support `len()` ? For this, the workaround you posted works, at least. It's not convenient, but it also does not seem like a common need - again I'd

[go-nuts] Re: Generic "nillable" constraint

2022-12-22 Thread Pierre Durand
Same question for `len()`: is there a way to declare a constraint that matches types that support `len()` ? Le jeudi 22 décembre 2022 à 14:23:22 UTC+1, Pierre Durand a écrit : > Is there a way to declare a "nillable" constraint that matches all types > that can be nil (pointer, slice, map, etc.