Currently the predeclared types (int, bool, float32, string, etc) do not have any methods on them. It appears to me that if they would, the generic implementation for math.Min/Max etc could do without 'types' in interfaces (as is currently proposed).
For example: type Sortable[T any] interface { Compare(T other) int } Suppose that int, float64, string etc all predeclare the Compare(T) int method. Then func Max[T Sortable[T]](a, b T) T { if a.Compare(b) >= 0 { return a } return b } Is this something that was considered or is this just a bad idea? (It would require that all predeclared types expose most operators in some method form). One obvious benefit is that Max works for any user type as well (instead of only predeclared types). Another benefit is that the interface{} concept would not need to be extended (at least for the purpose of generics) with type lists. Markus -- 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/7afd3902-1529-4137-8377-88469de0c398n%40googlegroups.com.