Dear all, I stumbled across a difference between type names and type parameter names (in the go1.18 beta): I can re-use a type name as a variable name, but the same is not possible with type parameter names. Is this difference intentional?
For illustration, the following code is valid https://go.dev/play/p/r2NAddZmoE3 : type other int func test(x other) other { other := x + 1 return other } But this doesn't work https://go.dev/play/p/Dsh9IgvKDDY?v=gotip : type Numeric interface { ~int | ~float64 } func test[other Numeric](x other) other { other := x + 1 return other } All the best, Jochen -- 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/4d0066c3-315d-4746-a0cf-3749bfbcb45dn%40googlegroups.com.