Thread overview
[Issue 10959] std.algorithm.remove is highly bug-prone
Feb 10, 2018
Seb
Dec 17, 2022
Iain Buclaw
Aug 11
mw
February 10, 2018
https://issues.dlang.org/show_bug.cgi?id=10959

Seb <greensunny12@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |greensunny12@gmail.com

--- Comment #14 from Seb <greensunny12@gmail.com> ---
A PR to fix the landmines - https://github.com/dlang/phobos/pull/6154

It's probably too late to rename `remove` :/

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=10959

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P3

--
August 11
https://issues.dlang.org/show_bug.cgi?id=10959

mw <mingwu@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mingwu@gmail.com

--- Comment #15 from mw <mingwu@gmail.com> ---
Hit this one today,

Has `removeAt` or `removeAtIndex` be added to the std lib?

BTW, for associative array, `remove()` is in-place; but here for std.algorithm.mutation.remove, one need to do

```
  array = array.remove(index);  // return a new container

  // v.s.
  aa.remove(key);  // return bool (if it's removed)
```

This in-consistence is really bad.

--
August 21
https://issues.dlang.org/show_bug.cgi?id=10959

Andy Valencia <ajv-271-109-6446@vsta.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ajv-271-109-6446@vsta.org

--- Comment #16 from Andy Valencia <ajv-271-109-6446@vsta.org> ---
(In reply to Seb from comment #14)
> A PR to fix the landmines - https://github.com/dlang/phobos/pull/6154
> 
> It's probably too late to rename `remove` :/

I'd suggest deprecating it, and adding removeAt and removeValue

It is certainly, as several people have commented, a landmine.

--