On Wednesday, January 6, 2021 at 9:40:15 AM UTC-5 Brian Candler wrote:
> On Wednesday, 6 January 2021 at 12:40:24 UTC tapi...@gmail.com wrote: > >> func blah[T1]T2 (x T1) T2 { ... } >>> >>> x := blah[int]string(123) >>> >> >> I didn't see anyone propose this syntax from the above comments. >> > > To quote the message which started the thread: > > > > *I think something like sync.Map[string]linked.List string is more > readable than sync.Map[string, linked.List[string]].* > *I propose putting the last type parameter to a generic type after the > square brackets and omitting them when there is only one type parameter.* > > I accept it was talking about type parameters to types, not type > parameters to functions (although it would be weird if they were different). > > But even if you think only about types, it doesn't make much sense to make > the last type parameter distinct from the others. Another silly example: > > # current > type Circle[T1,T2 any] struct { > x,y,radius T1 > color T2 > } > > type myCircle Circle[float64,string] > > # proposed > type Circle[T1 any]T2 any struct { > x,y,radius T1 > color T2 > } > > type myCircle Circle[float64]string > I think OP's mistake "argument" as "parameter" in title. OP didn't specify how to declare a generic type. -- 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/d5df1e82-c31e-41fa-a3e5-20acbf8d722fn%40googlegroups.com.