>> The issue is, that a "KeyValuePair<K, V>" (no matter if you implemented it via generics or like you mention via interfaces) is a fundamentally useless type and generics encourage people to add useless types. A "KeyValuePair<K, V>" is a "struct { Key K, Value V }", plain and simple. It's not an interface and it's not a generic type, it's simply a struct.
I not agree with you only because with generics this pattern is always type safe. Eg. type Foo<K, V> struct { key K val V } func accepInt(i int) { } func some() string { foo := &Foo<string, int>() // some code // Compile error: `key` is not `int` acceptInt(foo.key) // Compile error: `key` (int) cannot be compared with `string` if foo.key == foo.val { } // Compile error: `key` is not `string` return foo.val } func baz(foo Foo<K, V>) bool { // Compile error: `key` (K) cannot be compared with `V` return foo.key == foo.val } -- 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. For more options, visit https://groups.google.com/d/optout.