Re: [go-nuts] [generics] Feedback on optional type keyword experiment

2020-07-25 Thread Bakul Shah
I like it! BTW, I don't understand the meaning of this comment in the commit log: > >> Experiment: Make "type" keyword optional in generic type declarations when > >> it is clear that we can't have an array type declaration. It is talking about defining generic arrays, where one parameter may

Re: [go-nuts] [Generics] Feedback on updated draft

2020-07-23 Thread Ian Lance Taylor
On Thu, Jul 23, 2020 at 1:12 AM Aleksey Tulinov wrote: > > First of all, thank you for taking your time to answer this topic. I > know some stuff i say is dumb, i appreciate your patience. > > To answer your question: i would assume that OR is about as useful as > AND or NOT. > > type Constraint

Re: [go-nuts] [Generics] Feedback on updated draft

2020-07-23 Thread Aleksey Tulinov
Ian, First of all, thank you for taking your time to answer this topic. I know some stuff i say is dumb, i appreciate your patience. To answer your question: i would assume that OR is about as useful as AND or NOT. type Constraint interface { Sequence && !Channel } With that said. So far

Re: [go-nuts] [Generics] Feedback on updated draft

2020-07-23 Thread Ian Lance Taylor
On Wed, Jul 22, 2020 at 9:41 PM Aleksey Tulinov wrote: > > This is Java-style inheritance. It isn't bad, but i think that > C++-style composition is somehow more in the spirit of Go. Strictly > personal opinion of course. Older proposal described constraints as > expressions, so to me it appears

Re: [go-nuts] [Generics] Feedback on updated draft

2020-07-22 Thread Aleksey Tulinov
I'm not sure if i understood everything correctly. type structField(type T) struct { a int x T } But this is a generic type, not a constraint for a type, isn't it? Constraint is this: type Custom interface{ type int, float64, uint64 } type structField(type T Custom) interface {

Re: [go-nuts] [Generics] Feedback on updated draft

2020-07-22 Thread lx . gulak
Hey! I would like to join the discussion and add my 5 cents here, since I have been criticizing the contracts draft and I would like to show what were my points in order to support the current design draft. I believe the original problem for the generics is to allow the same function to

Re: [go-nuts] [Generics] Feedback on updated draft

2020-07-22 Thread Ian Lance Taylor
On Wed, Jul 22, 2020 at 5:12 PM Aleksey Tulinov wrote: > > Hmm. I must have read the previous version, but it probably was some > time ago. I have to say that i like the previous version more than the > current one. > > I definitely don't like this: > > type structField interface { > type

Re: [go-nuts] [Generics] Feedback on updated draft

2020-07-22 Thread Aleksey Tulinov
Hmm. I must have read the previous version, but it probably was some time ago. I have to say that i like the previous version more than the current one. I definitely don't like this: type structField interface { type struct { a int; x int }, struct { b int; x float64 }, struct { c int;

Re: [go-nuts] [Generics] Feedback on updated draft

2020-07-22 Thread Ian Lance Taylor
On Wed, Jul 22, 2020 at 1:46 PM Aleksey Tulinov wrote: > > I'm not really a language designer and i don't use Go extensively, so > please take my words with a grain of salt. But I like Go and would > like to use it, and I'd like to put my 2 cents into the jar. I'm sorry > if this was already

Re: [go-nuts] Generics feedback

2020-06-28 Thread t hepudds
Hello Calum, One FYI that Tyler Compton pulled together a helpful list of dozen or so different alternative generics syntax suggestions along with their corresponding recent golang-nuts threads: https://groups.google.com/d/msg/golang-nuts/uQDrcHDwT_w/Y-Myzuw_AQAJ That could be a helpful

Re: [go-nuts] Generics feedback

2020-06-28 Thread Calum Shaw-Mackay
" I believe over time, it will a) become clear that generic code will be less common than people think (I hope) and b) that you get used to the syntax either way. (also, yes, this has been discussed before, ad nauseam in fact :) )” Yes I also hope that the need to generify everything is kept

Re: [go-nuts] Generics feedback

2020-06-28 Thread 'Axel Wagner' via golang-nuts
Readability, at the end of the day, is subjective. So, personally: Yes, I absolutely find it more readable than any alternative that has been suggested. Personally, when I see code using a bunch of extra symbols that have special meaning (Perl and Haskell are extreme examples), I tend to "zone