<div dir="ltr">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 :)<div><br>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/8/25 bearophile <span dir="ltr"><<a href="mailto:bearophileHUGS@lycos.com" target="_blank">bearophileHUGS@lycos.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
maarten van damme:<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
But remove doesn't truly remove from the source range because the length of<br>
the source range stays the same. It's return value is a modified copy of<br>
the source range.<br>
<br>
Filter doesn't really work right away because that would also remove<br>
duplicate elements while I only want to remove at a given index. It also<br>
makes for clunkier looking code and is counterintinuitive to come up with<br>
(I want to remove an element therefore I have to filter every element that<br>
isn't equal to that element from the source range...)<br>
And while I haven't worked in c++, even that appears to have remove_copy<br>
which is really what I want.<br>
</blockquote>
<br></div>
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.<br>
<br>
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.<br>
<br>
Bye,<br>
bearophile<br>
</blockquote></div><br></div>