Re: [go-nuts] [generics] Replace () with <> or other character

2020-06-18 Thread Ian Lance Taylor
On Wed, Jun 17, 2020 at 10:52 PM Brian Zhao wrote: > > Out of curiosity, would it be possible to have a workaround for the infinite > lookahead problem? > > I happened to see a similar issue mentioned when implementing Swift Generics: > https://github.com/apple/swift/blob/5bdc5ccd61cd43217e4f4e3

Re: [go-nuts] [generics] Replace () with <> or other character

2020-06-18 Thread Sam Mortimer
On Wednesday, June 17, 2020 at 5:50:24 PM UTC-7, Ian Lance Taylor wrote: > > On Wed, Jun 17, 2020 at 9:36 AM Charles Crete > wrote: > > > > Based on the new proposal, having the type parameters as () seems very > confusing, as now 3 things in a row use (): > > - Type parameters > > - Functio

Re: [go-nuts] [generics] Replace () with <> or other character

2020-06-18 Thread Jesper Louis Andersen
On Thu, Jun 18, 2020 at 6:38 PM Brian Zhao wrote: > Would something similar work in go's parser? I'm personally in favor of > the <> syntax, since it's very similar to other languages (C++, Swift, > Rust, Java, C#). > > It is just another parameter. I wouldn't give it special syntactical treatmen

Re: [go-nuts] [generics] Replace () with <> or other character

2020-06-18 Thread Brian Zhao
Out of curiosity, would it be possible to have a workaround for the infinite lookahead problem? I happened to see a similar issue mentioned when implementing Swift Generics: https://github.com/apple/swift/blob/5bdc5ccd61cd43217e4f4e3515e32eb45e728df0/docs/Generics.rst#parsing-issues, and the propo

Re: [go-nuts] [generics] Replace () with <> or other character

2020-06-17 Thread Ian Lance Taylor
On Wed, Jun 17, 2020 at 9:36 AM Charles Crete wrote: > > Based on the new proposal, having the type parameters as () seems very > confusing, as now 3 things in a row use (): > - Type parameters > - Function parameters/arguments > - Return tuple > > This results in code like (from the draft): > fu

Re: [go-nuts] [generics] Replace () with <> or other character

2020-06-17 Thread Dimas Prawira
more and more like Java.. BR On Wed, Jun 17, 2020 at 11:36 PM Charles Crete wrote: > Based on the new proposal, having the type parameters as () seems very > confusing, as now 3 things in a row use (): > - Type parameters > - Function parameters/arguments > - Return tuple > > This results in c

[go-nuts] [generics] Replace () with <> or other character

2020-06-17 Thread Charles Crete
Based on the new proposal, having the type parameters as () seems very confusing, as now 3 things in a row use (): - Type parameters - Function parameters/arguments - Return tuple This results in code like (from the draft): func Stringify(type T Stringer)(s []T) (ret []string) { for _, v := rang