Re: [go-nuts] Why not use F in generic?

2020-06-24 Thread Hein Meling
I think David Chase’s idea is interesting. -- 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 th

Re: [go-nuts] Why not use F in generic?

2020-06-23 Thread roger peppe
On Tue, 23 Jun 2020 at 03:04, Ian Lance Taylor wrote: > On Mon, Jun 22, 2020 at 6:19 PM 移库海牙客 wrote: > > > > I agree the syntax should be more readable and easier to understand. But > I think the current syntax is less readable. > > For example: > > > > type I2 interface { > > (I1(int)) > > } >

Re: [go-nuts] Why not use F in generic?

2020-06-22 Thread 移库海牙客
Embed interface is common practice. There is no extra cost in F. It is more readable because we can identify generic whenever we see <>. We must use more time to discover a generic using F(T), it looks like a function. And it solve problems like embed types. Most people just don't get use to it

Re: [go-nuts] Why not use F in generic?

2020-06-22 Thread Ian Lance Taylor
On Mon, Jun 22, 2020 at 6:19 PM 移库海牙客 wrote: > > I agree the syntax should be more readable and easier to understand. But I > think the current syntax is less readable. > For example: > > type I2 interface { > (I1(int)) > } > > > type S2 struct { > (S1(int)) > } > > > We must use redundant bracke

Re: [go-nuts] Why not use F in generic?

2020-06-22 Thread 移库海牙客
I agree the syntax should be more readable and easier to understand. But I think the current syntax is less readable. For example: type I2 interface { (I1(int))} type S2 struct { (S1(int))} We must use redundant brackets to keep the syntax right. I don't think this is readabl

Re: [go-nuts] Why not use F in generic?

2020-06-22 Thread 'drc...@google.com' via golang-nuts
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, 202

Re: [go-nuts] Why not use F in generic?

2020-06-22 Thread Ian Lance Taylor
On Mon, Jun 22, 2020 at 10:09 AM James L 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 ha

Re: [go-nuts] Why not use F in generic?

2020-06-22 Thread James L
Have you read other thread which have been answered many times? On Tue, 23 Jun 2020 at 12:46 AM, wrote: > I read the new generic draft. And I know F,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. > > fu

[go-nuts] Why not use F in generic?

2020-06-22 Thread redstorm . fyy
I read the new generic draft. And I know F,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 Print(s []T) {} Print([]int{1, 2, 3}) -- You rece