Re: [go-nuts] Re: [generics] Type lists should be usable in any interface

2020-06-23 Thread 'Bryan C. Mills' via golang-nuts
My brain was stuck on subtyping yesterday, and when I thought about how subtyping relates to type-list interfaces I realized that they could be made more orthogonal — and more like existing interface types, more useful as sum types, and perhaps even more amenable to specialization via type-switches

Re: [go-nuts] Re: [generics] Type lists should be usable in any interface

2020-06-22 Thread 'Bryan C. Mills' via golang-nuts
On Sat, Jun 20, 2020 at 5:25 PM Ian Lance Taylor wrote: > On Fri, Jun 19, 2020 at 1:50 PM Bryan C. Mills wrote: > > > > On Fri, Jun 19, 2020 at 2:38 PM Ian Lance Taylor > wrote: > >> > >> On Fri, Jun 19, 2020 at 9:31 AM Bryan C. Mills > wrote: > >> > > >> > On Fri, Jun 19, 2020 at 1:30 AM Ian

Re: [go-nuts] Re: [generics] Type lists should be usable in any interface

2020-06-20 Thread Ian Lance Taylor
On Fri, Jun 19, 2020 at 1:50 PM Bryan C. Mills wrote: > > On Fri, Jun 19, 2020 at 2:38 PM Ian Lance Taylor wrote: >> >> On Fri, Jun 19, 2020 at 9:31 AM Bryan C. Mills wrote: >> > >> > On Fri, Jun 19, 2020 at 1:30 AM Ian Lance Taylor wrote: >> >> >> >> This code is acting as though, if ordinary

Re: [go-nuts] Re: [generics] Type lists should be usable in any interface

2020-06-19 Thread 'Bryan C. Mills' via golang-nuts
On Fri, Jun 19, 2020 at 2:38 PM Ian Lance Taylor wrote: > On Fri, Jun 19, 2020 at 9:31 AM Bryan C. Mills wrote: > > > > On Fri, Jun 19, 2020 at 1:30 AM Ian Lance Taylor > wrote: > >> > >> This code is acting as though, if ordinary interface types could have > >> type lists, it would be OK to wr

Re: [go-nuts] Re: [generics] Type lists should be usable in any interface

2020-06-19 Thread Ian Lance Taylor
On Fri, Jun 19, 2020 at 9:31 AM Bryan C. Mills wrote: > > On Fri, Jun 19, 2020 at 1:30 AM Ian Lance Taylor wrote: >> >> This code is acting as though, if ordinary interface types could have >> type lists, it would be OK to write >> >> func Add2(x, y SmallInt) SmallInt { return x + y }ᵢ >> >> That

Re: [go-nuts] Re: [generics] Type lists should be usable in any interface

2020-06-19 Thread David Suarez
I agree generally with constraint and interface really being different should be named differently. Is the simplest solution that is also clean to have a constraint type that only allows the type parameter (for now) and can also include an interface type? The generic definitions can allow for

Re: [go-nuts] Re: [generics] Type lists should be usable in any interface

2020-06-19 Thread 'Bryan C. Mills' via golang-nuts
On Fri, Jun 19, 2020 at 1:30 AM Ian Lance Taylor wrote: > On Wed, Jun 17, 2020 at 7:58 PM 'Bryan C. Mills' via golang-nuts > wrote: > > > > On Wednesday, June 17, 2020 at 12:08:59 AM UTC-4 Ian Lance Taylor wrote: > >> > >> On Tue, Jun 16, 2020 at 9:04 PM Xie Zhenye wrote: > >> > > >> > I agree.

Re: [go-nuts] Re: [generics] Type lists should be usable in any interface

2020-06-18 Thread Ian Lance Taylor
On Wed, Jun 17, 2020 at 7:58 PM 'Bryan C. Mills' via golang-nuts wrote: > > On Wednesday, June 17, 2020 at 12:08:59 AM UTC-4 Ian Lance Taylor wrote: >> >> On Tue, Jun 16, 2020 at 9:04 PM Xie Zhenye wrote: >> > >> > I agree. constraint is different from normal interface. It's better to use >> > t

Re: [go-nuts] Re: [generics] Type lists should be usable in any interface

2020-06-17 Thread 'Bryan C. Mills' via golang-nuts
On Wednesday, June 17, 2020 at 12:08:59 AM UTC-4 Ian Lance Taylor wrote: > On Tue, Jun 16, 2020 at 9:04 PM Xie Zhenye wrote: > > > > I agree. constraint is different from normal interface. It's better to > use type SomeConstraint constraint {} than type SomeConstraint interface {} > > That is

Re: [go-nuts] Re: [generics] Type lists should be usable in any interface

2020-06-16 Thread Ian Lance Taylor
On Tue, Jun 16, 2020 at 9:04 PM Xie Zhenye wrote: > > I agree. constraint is different from normal interface. It's better to use > type SomeConstraint constraint {} than type SomeConstraint interface {} That is an option, but then we would have two different concepts, constraints and interfaces

[go-nuts] Re: [generics] Type lists should be usable in any interface

2020-06-16 Thread Xie Zhenye
I agree. constraint is different from normal interface. It's better to use type SomeConstraint constraint {} than type SomeConstraint interface {} On Wednesday, June 17, 2020 at 11:12:24 AM UTC+8 Brandon Dyck wrote: > I find it a little strange that an interface with a type list can only be >