uniform method naming convention for all lib std containers
mw
mingwu at gmail.com
Sun Aug 11 23:53:04 UTC 2024
From this thread:
https://forum.dlang.org/post/warxdyxbpnbxwixgrxwm@forum.dlang.org
On Thursday, 5 February 2015 at 14:09:10 UTC, bearophile wrote:
> Tobias Pankrath:
>
>> Works as designed:
>> http://dlang.org/phobos/std_algorithm.html#.remove
>
> Unfortunately it's one of the worst designed functions of
> Phobos:
> https://issues.dlang.org/show_bug.cgi?id=10959
>
> Bye,
> bearophile
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 (*keyword*: mutation), one need to
do
```
array = array.remove(index); // return a new container, not
quite *in-place*
// v.s.
aa.remove(key); // return bool (if it's removed)
```
This in-consistence is really bad.
On Sunday, 11 August 2024 at 13:13:02 UTC, Lance Bachmeier wrote:
> You may want to create a new thread about this in General. If
> it's going to get changed, now is the time as they're working
> on updates to Phobos, but they're not going to see this post.
Also, this api re-work is related to this DIP: @mustuse as
function return value annotation
https://github.com/mw66/mustuse/blob/main/mustuse.md
More information about the dip.ideas
mailing list