That’s a very interesting idea. It would probably need to be extended to allow specifying that a type is like multiple types. Then the effective “contract” would be the intersection of the operations provided by those types. For example, we would want to be able to specify a type that is like both string and []byte; it would support len, range, and indexing, but not + or mutation.
Combining this concept with the function syntax from the standard proposal, here is what the classic Min function would look like: func Min(type T like(int, float64))(a, b T) T { if a < b { return a } return b } Andy -- 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.