We could regard the function as a method on the type(s), maybe? Not sure if this is a good idea or not, especially since we don't have multimethods (methods applied to multiple values) for ordinary values.
On Monday, June 22, 2020 at 1:53:56 PM UTC-4 Ian Lance Taylor wrote: > On Mon, Jun 22, 2020 at 10:09 AM James L <jamesl...@gmail.com> wrote: > > > > Have you read other thread which have been answered many times? > > In fairness, this idea is different, because the type comes first. > Since the '<' character will always be the start of an expression, I > think it may be unambiguous. I think this has been suggested before > also, though I'm not sure where. > > I don't personally like this syntax because it seems to put the cart > before the horse. In a function call, I would expect to see the Print > function with a type argument int. This flips the order so that we > see int first, then we see that we are talking about the Print > function. Even if it could work syntactically, it seems to me to be > less readable. > > The goal in any syntax suggestion should be more than just "this might > work." It should be "this is more readable and easier to understand." > And personally I don't think this specific suggestion meets that > goal. > > Thanks for the comment, though. > > Ian > > > > On Tue, 23 Jun 2020 at 12:46 AM, <redsto...@gmail.com> wrote: > >> > >> I read the new generic draft. And I know F<T>,F[T],F《T》 is discarded. I > think put the type paremeter in front of the function name may be better. > No ambiguous and more readable code. > >> > >> func Print(type T)(s []T) { > >> > >> } > >> > >> Print(int)([]int{1, 2, 3}) > >> > >> func <type T>Print(s []T) { > >> > >> } > >> > >> <int>Print([]int{1, 2, 3}) > >> > >> > >> > >> -- > >> 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...@googlegroups.com. > >> To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/c55ab443-4333-4def-9d9c-6657463a4a75o%40googlegroups.com > . > > > > -- > > 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...@googlegroups.com. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/CAHo5hB6-myagSyixYPfghVYBE3DUpQMYSj88%2BjB74hbJvzQApQ%40mail.gmail.com > . > -- 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/8df1b05b-3e0c-4b3d-a714-a6cf34964f45n%40googlegroups.com.