std.algorithm's remove
maarten van damme
maartenvd1994 at gmail.com
Sat Aug 24 20:58:09 PDT 2013
I'm not sure if it really is my place to criticize design decisions of a
language written by people that devoted their career to computer science
while I have only read some books out of boredom :)
2013/8/25 bearophile <bearophileHUGS at lycos.com>
> maarten van damme:
>
>
> But remove doesn't truly remove from the source range because the length
>> of
>> the source range stays the same. It's return value is a modified copy of
>> the source range.
>>
>> Filter doesn't really work right away because that would also remove
>> duplicate elements while I only want to remove at a given index. It also
>> makes for clunkier looking code and is counterintinuitive to come up with
>> (I want to remove an element therefore I have to filter every element that
>> isn't equal to that element from the source range...)
>> And while I haven't worked in c++, even that appears to have remove_copy
>> which is really what I want.
>>
>
> I agree that the design of std.algorithm.remove is bug prone. The compiler
> doesn't verify that you are using its result! I have also filed several
> bugs regarding the implementation of std.algorithm.remove.
>
> In the end your complaints are real. You can't expect Phobos to be
> perfect, but people work to fix it. Fixing such problems future D users
> will not find your problem. So I suggest you to think well about what your
> problem is, what you don't like on this, and then write a enhancement
> request for Phobos. Even if std.algorithm.remove can't be fixed, people can
> add a new function with a safer/more handy behavour.
>
> Bye,
> bearophile
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20130825/86614f59/attachment.html>
More information about the Digitalmars-d-learn
mailing list