I just learned that type constraints, which are defined as interfaces are 
actually not usable in all the places "normal" interfaces can be used in. 
E.g., why can a constraint interface not be uses as a struct type?

Let's say I have the func `func Smallest[T constraints.Ordered](s []T) T`. 
How do I write a table test for this func? Intuitively one would try to 
store tests like this:

tests := []struct {
    Arr: []constraints.Ordered
    Want: constraints.Ordered
}{...}

But this is not permitted. Am I missing something why this behavior is 
should be considered good? If a type constraint is nothing like an 
interface... okay, but why call it interface then?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/53df110e-8f34-490a-9b77-610dacffdbcfn%40googlegroups.com.

Reply via email to