Skip to content

Unify function overloads in std.range#5605

Closed
wilzbach wants to merge 3 commits intodlang:masterfrom
wilzbach:unify-std-range
Closed

Unify function overloads in std.range#5605
wilzbach wants to merge 3 commits intodlang:masterfrom
wilzbach:unify-std-range

Conversation

@wilzbach
Copy link
Contributor

Yet another small step towards better, more digestable documentation (and hiding things that the user doesn't need to know).

Let's see whether the CODEOWNERS file finally works ...

@wilzbach wilzbach added the Review:Trivial typos, formatting, comments label Jul 12, 2017
@dlang-bot
Copy link
Contributor

Thanks for your pull request, @wilzbach!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Copy link
Member

@quickfur quickfur left a comment

Choose a reason for hiding this comment

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

Overall, LGTM, other than my question about using Unqual in chooseAmong.

if (Ranges.length > 2
&& is(typeof(choose(true, rs[0], rs[1])))
&& is(typeof(chooseAmong(0, rs[1 .. $]))))
if (Ranges.length >= 2 && allSatisfy!(isInputRange, staticMap!(Unqual, Ranges)))
Copy link
Member

Choose a reason for hiding this comment

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

Why Unqual here? Does chooseAmong actually work for, say, immutable "ranges"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because of the is(typeof(choose(true, rs[0], rs[1]))) constraint, which reduces to the following:

auto choose(R1, R2)(bool condition, R1 r1, R2 r2)
if (isInputRange!(Unqual!R1) && isInputRange!(Unqual!R2) &&
    !is(CommonType!(ElementType!(Unqual!R1), ElementType!(Unqual!R2)) == void))

(The common type is handles latter as static assert for user-friendliness)

Copy link
Member

Choose a reason for hiding this comment

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

I see. Kinda weird, but OK.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, but I didn't want to touch the behavior in this PR - so I opted to emulate the current behavior.

{
static assert(0, "The ranges have no common type.");
}
}
Copy link
Member

Choose a reason for hiding this comment

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

This merged overload set LGTM, other than my question about Unqual.

else
{
return Take!R(input, n);
}
Copy link
Member

Choose a reason for hiding this comment

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

This merged overload set also LGTM.

static if (!is(R == class))
return RefRange!R(range);
else
return *range;
Copy link
Member

Choose a reason for hiding this comment

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

This merged overload set also LGTM. Thanks!

@PetarKirov
Copy link
Member

@wilzbach can you put each overload set change into a separate commit?

@quickfur
Copy link
Member

@ZombineDev Good idea!

Copy link
Member

@PetarKirov PetarKirov left a comment

Choose a reason for hiding this comment

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

LGTM, just move the changes into separate commits.

@wilzbach
Copy link
Contributor Author

LGTM, just move the changes into separate commits.

Okay - good suggestion!

@wilzbach
Copy link
Contributor Author

image

@CyberShadow did I break DAutoTest? ;-)

@CyberShadow
Copy link
Member

Heh, that's a race condition. It'll get round to retest it

@wilzbach
Copy link
Contributor Author

Heh, that's a race condition. It'll get round to retest it

I can simply rebase, I just thought I let you know while it's still easy to see the logs ;-)

@CyberShadow
Copy link
Member

Yep, not a bug. IIRC Travis will also fail when you update a PR while it's starting up.

@wilzbach
Copy link
Contributor Author

Hmm it happened again - even with my rebase:

image

@wilzbach wilzbach closed this Jul 12, 2017
@wilzbach wilzbach reopened this Jul 12, 2017
@wilzbach
Copy link
Contributor Author

Okay, as rebasing doesn't seem to help, I will try to open a new PR :/

@wilzbach wilzbach closed this Jul 12, 2017
@CyberShadow
Copy link
Member

Ping me if it happens again, I'll see which SHA is wrong.

@CyberShadow
Copy link
Member

Actually let me add that to the error message right now.

@wilzbach
Copy link
Contributor Author

Ping me if it happens again, I'll see which SHA is wrong.

While reopening fixed the problem with CircleCi, it seems like DAutoTest still doesn't like it.
I'm still not sure what I have done wrong or how I could fix it?

@CyberShadow
Copy link
Member

While reopening fixed the problem with CircleCi, it seems like DAutoTest still doesn't like it.

Closing and reopening has zero effect on DAutoTest currently, you'll need to rebase or wait until something else is merged and it tests the PR again against the new merge target.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review:Trivial typos, formatting, comments

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants