Re: [go-nuts] Question on the generics proposal and arrays

2020-10-07 Thread Markus Heukelom
On Wed, Oct 7, 2020 at 9:12 PM Howard C. Shaw III wrote: > You said: > >> I was trying around with arrays and generics because slices are more >> complex to reason about than arrays. For example, I introduced bugs into my >> code by not being fully aware of slices overwriting original data when y

Re: [go-nuts] Question on the generics proposal and arrays

2020-10-07 Thread Howard C. Shaw III
You said: > I was trying around with arrays and generics because slices are more > complex to reason about than arrays. For example, I introduced bugs into my > code by not being fully aware of slices overwriting original data when you > append to them and the capacity is not set correctly. So

Re: [go-nuts] Question on the generics proposal and arrays

2020-10-06 Thread Ian Lance Taylor
On Tue, Oct 6, 2020 at 6:32 AM Markus Heukelom wrote: > > It appears to me the current proposal does not allow you to write a function > that sorts an array of any size: > > func SortArray[T comparable](array [??]T, less func(a, b T) bool) [??]T {} > > Is it correct that this is not possible? Or