Re: [go-nuts] [generics] where to find predefined constraint aggregations?

2020-06-24 Thread 'Yongjian (Jim) Xu' via golang-nuts
On Wednesday, June 24, 2020 at 3:55:07 PM UTC-7 Ian Lance Taylor wrote: > On Wed, Jun 24, 2020 at 3:47 PM i3dmaster wrote: > > > > On Wednesday, June 24, 2020 at 3:02:43 PM UTC-7, Ian Lance Taylor wrote: > >> > >> The current generics design draft doesn't support the kind of > >> constrain

Re: [go-nuts] [generics] where to find predefined constraint aggregations?

2020-06-24 Thread Ian Lance Taylor
On Wed, Jun 24, 2020 at 3:47 PM i3dmaster wrote: > > On Wednesday, June 24, 2020 at 3:02:43 PM UTC-7, Ian Lance Taylor wrote: >> >> The current generics design draft doesn't support the kind of >> constraints you are looking for. > > > Is there or will there be a plan? Using generic types with [],

Re: [go-nuts] [generics] where to find predefined constraint aggregations?

2020-06-24 Thread i3dmaster
On Wednesday, June 24, 2020 at 3:02:43 PM UTC-7, Ian Lance Taylor wrote: > > On Wed, Jun 24, 2020 at 2:33 PM i3dmaster > > wrote: > > > > example: > > > > type Key interface { > > type comparable, fmt.Stringer > > } > > > > type Value interface { > > type interface{}, copyable

Re: [go-nuts] [generics] where to find predefined constraint aggregations?

2020-06-24 Thread Ian Lance Taylor
On Wed, Jun 24, 2020 at 2:33 PM i3dmaster wrote: > > example: > > type Key interface { > type comparable, fmt.Stringer > } > > type Value interface { > type interface{}, copyable > } > > type Container(type K Key, V Value) interface { >Add(K, V) bool > } > > type HashMap(type K Key, V

[go-nuts] [generics] where to find predefined constraint aggregations?

2020-06-24 Thread i3dmaster
example: type Key interface { type comparable, fmt.Stringer } type Value interface { type interface{}, copyable } type Container(type K Key, V Value) interface { Add(K, V) bool } type HashMap(type K Key, V Value) struct{ m map[K]V } func (h *HashMap(K,V)) Add(k K, v V) bool { h.