Re: [go-nuts] Possible Go 2 proposal for built-in Remove method for Slices.

2021-02-06 Thread Wojciech S. Czarnecki
Dnia 2021-02-06, o godz. 12:24:59 Martin Schnabel napisał(a): > > A "remove element from _slice_" operation always must make a new array > > and copy all elements that you intend to stay. Current idiom using append > > will do this for you while being frank about costs. > Maybe I misunderstand

Re: [go-nuts] Possible Go 2 proposal for built-in Remove method for Slices.

2021-02-06 Thread Kevin Chadwick
>> > >> > A "remove element from _slice_" operation always must make a new >array >> > and copy all elements that you intend to stay. Current idiom using >append >> > will do this for you while being frank about costs. >> >> Maybe I misunderstand what you wrote, but as long as the slice has >> enou

Re: [go-nuts] Possible Go 2 proposal for built-in Remove method for Slices.

2021-02-06 Thread Arnaud Delobelle
On Sat, 6 Feb 2021 at 11:25, Martin Schnabel wrote: > > > > On 06.02.21 03:32, Wojciech S. Czarnecki wrote: > > Dnia 2021-02-04, o godz. 00:30:57 > > Selahaddin Harmankaya napisał(a): > > > >> There are obviously more things to consider > > > > Slice is not an array, it is a _view_into_ an array.

Re: [go-nuts] Possible Go 2 proposal for built-in Remove method for Slices.

2021-02-06 Thread Martin Schnabel
On 06.02.21 03:32, Wojciech S. Czarnecki wrote: Dnia 2021-02-04, o godz. 00:30:57 Selahaddin Harmankaya napisał(a): There are obviously more things to consider Slice is not an array, it is a _view_into_ an array. Many such views into the same array may exist simultaneously. A "remove ele

Re: [go-nuts] Possible Go 2 proposal for built-in Remove method for Slices.

2021-02-05 Thread Wojciech S. Czarnecki
Dnia 2021-02-04, o godz. 00:30:57 Selahaddin Harmankaya napisał(a): > There are obviously more things to consider Slice is not an array, it is a _view_into_ an array. Many such views into the same array may exist simultaneously. A "remove element from _slice_" operation always must make a new a

[go-nuts] Possible Go 2 proposal for built-in Remove method for Slices.

2021-02-04 Thread Selahaddin Harmankaya
Hi, I wonder if there are any proposals for the Remove method for Slices, which removes an element from a Slice. Since the status of the latest generics draft is `likely accepted` and it'd be possible to implement this with `generics`. I believe such an addition to language would alleviate th