Skip to content

Conversation

quickfur
Copy link
Member

Fixes: https://issues.dlang.org/show_bug.cgi?id=13936

Basically, rip out support for non-equivalence ranges (for now) and restrict the current groupBy implementation to input ranges only. Forward ranges and higher will use Andrei's proposed design that avoids the need to popFront through each subrange more than once in a linear traversal of the underlying range.

However, the new code is not expected to pass the autotester just yet, because of blocking issues with RefCounted being neither @safe, pure, nor nothrow.

@andralex
Copy link
Member

I see dead unittests.

@andralex
Copy link
Member

Oh, you mentioned it...

@quickfur
Copy link
Member Author

You can get the unittests to run by commenting out pure @safe nothrow from the failing tests. However, i didn't include that in this PR to make sure we don't merge until RefCounted is fixed.

@quickfur
Copy link
Member Author

Oh, speaking of which, is anybody actually looking into fixing RefCounted? because I have no idea how it works and I'm not sure I want to be poking my grubby fingers into the icky innards of RefCounted at this time...

@andralex
Copy link
Member

Between this and RefCounted, I wouldn't want one to be blocked by another. I suggest we make unittests unsafe for now and file an issue for RefCounted.

@quickfur
Copy link
Member Author

I don't think that's going to go down well. The current groupBy implementation, for all of its flaws and inefficiencies, does fully support pure @safe nothrow; it may be inefficient but at least it's possible to use froom pure/safe/nothrow code. The new implementation may be efficient but at the cost of making it impossible to use from pure/@safe/nothrow code.

I think the correct solution is to work on RefCounted.

@andralex
Copy link
Member

There is no user for the current groupBy so no breakage.

We will work on RefCounted but it should be fine to release this with less guarantees and extend them later. If you're okay with letting this flap in the wind until the other is fixed, that's fine too but suboptimal (bit rot etc). May be good as a motivator though.

@quickfur
Copy link
Member Author

You're right, while there are users who follow git HEAD (bearophile, for example), it's not an official release so we are not obligated to support it. I'll comment out the failing attributes.

@quickfur
Copy link
Member Author

ping @andralex
So are we ready to merge or is there something else to do? The autotester is green now.

@quickfur
Copy link
Member Author

Rebased on new split std.algorithm package.

Restrict old groupBy implementation to input-only ranges.

Add unittest.

Temporarily disable failing attributes, until RefCounted is repaired to
support `@safe nothrow pure`.
@quickfur
Copy link
Member Author

Fixed compile error and rebased.

@quickfur
Copy link
Member Author

ping @andralex The autotester is green now. Are we merging this or not?

}
}
else
this(Range _r, ElementType!Range _prev)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the usual convention is members are _-prefixed and parameters aren't...

@andralex
Copy link
Member

Nice. The nitpicks are not important so if you're not around I'll pull this in 30 minutes or so and leave them to a future pass.

Thanks for this work!!

@quickfur
Copy link
Member Author

All done.

andralex added a commit that referenced this pull request Jan 23, 2015
New implementation of groupBy
@andralex andralex merged commit 0ffae68 into dlang:master Jan 23, 2015
@andralex
Copy link
Member

Fantastic. Thanks!

@quickfur quickfur deleted the new_groupBy branch January 23, 2015 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants