Re: [go-nuts] [generics] Should convertibility and comparibility of two types be two kinds of constraints?

2020-06-22 Thread T L
On Sunday, June 21, 2020 at 11:21:29 PM UTC-4, Ian Lance Taylor wrote: > > On Sat, Jun 20, 2020 at 7:30 PM T L > > wrote: > > > > On Saturday, June 20, 2020 at 4:48:07 PM UTC-4, Ian Lance Taylor wrote: > >> > >> On Sat, Jun 20, 2020 at 8:26 AM T L wrote: > >> > > >> > For example, if

Re: [go-nuts] [generics] Should convertibility and comparibility of two types be two kinds of constraints?

2020-06-21 Thread Ian Lance Taylor
On Sat, Jun 20, 2020 at 7:30 PM T L wrote: > > On Saturday, June 20, 2020 at 4:48:07 PM UTC-4, Ian Lance Taylor wrote: >> >> On Sat, Jun 20, 2020 at 8:26 AM T L wrote: >> > >> > For example, if there is a builtin convertible(from, to) constraint, >> > We can define a slice conversion function as

Re: [go-nuts] [generics] Should convertibility and comparibility of two types be two kinds of constraints?

2020-06-20 Thread T L
On Saturday, June 20, 2020 at 4:48:07 PM UTC-4, Ian Lance Taylor wrote: > > On Sat, Jun 20, 2020 at 8:26 AM T L > > wrote: > > > > For example, if there is a builtin convertible(from, to) constraint, > > We can define a slice conversion function as > > > > func Convert(type Ta, Tb

Re: [go-nuts] [generics] Should convertibility and comparibility of two types be two kinds of constraints?

2020-06-20 Thread Ian Lance Taylor
On Sat, Jun 20, 2020 at 8:26 AM T L wrote: > > For example, if there is a builtin convertible(from, to) constraint, > We can define a slice conversion function as > > func Convert(type Ta, Tb converitble(Ta, Tb)) (avs []Ta, _Tb) (bvs []Tb) { >bvs = make([]Tb, 0, len(avs) >for _, v :=

[go-nuts] [generics] Should convertibility and comparibility of two types be two kinds of constraints?

2020-06-20 Thread T L
For example, if there is a builtin convertible(from, to) constraint, We can define a slice conversion function as func Convert(type Ta, Tb converitble(Ta, Tb)) (avs []Ta, _Tb) (bvs []Tb) { bvs = make([]Tb, 0, len(avs) for _, v := range avs { bvs = append(bvs, Tb(v)) } return bvs