fix issue 15960 - deprecate setUnion in favor of merge#4249
fix issue 15960 - deprecate setUnion in favor of merge#4249andralex merged 1 commit intodlang:masterfrom
Conversation
|
d0c53b7 to
7439725
Compare
|
Personally I think One thing that is definitely out is silently changing the behaviour of |
makes sense. PR now deprecates |
|
@andralex tag needed, maybe we can even have a special |
|
Pardon my hazy memory, does |
The issue was that
It would still have a different behavior than C++ in the default case without Apart from that I think that the |
|
I agree with @wilzbach that D's I think a deprecation phase is the way forward with this. I'm fine with an extra BTW: @wilzbach did you look at my previous rejected PR at #3315? Note that Github says it's merged eventhough it was rejected. |
|
@wilzbach, thanks for your PR! By analyzing the annotation information on this pull request, we identified @quickfur, @andralex and @WalterBright to be potential reviewers. @quickfur: The PR was automatically assigned to you, please reassign it if you were identified mistakenly. |
After looking again at this, I still think that introducing To give a quick summary, the issue is that The proposed way out is to rename setUnion to After an appropriate deprecation phase
Sorry lost track of this PR. I like, but AFAICT it just adds bidirectionality to Last but not least I saw that I am not the only one who complained, on the other PR @lomereiter said:
|
|
Eh, fine |
|
Auto-merge toggled on |
|
@wilzbach |
This was just a rename from
The difference between void main(string[] args)
{
auto a = [1, 4, 9];
auto b = [1, 2, 3, 4, 5];
import std.algorithm, std.range, std.stdio;
writeln(setUnion(a, b)); // [1, 1, 2, 3, 4, 4, 5, 9]
writeln(roundRobin(a, b)); // [1, 1, 4, 2, 9, 3, 4, 5]
}You should also have a look at #3315, which is in fact even more similar to |
Have a look at:
http://en.cppreference.com/w/cpp/algorithm/merge
http://en.cppreference.com/w/cpp/algorithm/set_union
->
setUnionshould filter for duplicatesI propose to rename
setUniontomergeand letsetUnionfilter (like in C++). Moreover I added more tests and a better ddoc test for the user.I know that @andralex isn't quite a fan of such "house keeping", but sharing the same name to C++ and doing something different is quite astonishing to the user.
Let's fix this while the usage is still pretty low.
If this get's the OK pulled in, I will add a proper changelog with a long explanation.