New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
forward: single argument, copy const #5348
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM as it allows use cases that didn't work before (using forward
with const
arguments).
However,
- as mentioned I would move the full-blown example at the end of the public examples to avoid overloading the user in the beginning
- (a bit related) I heard talks that there are plans to extend compiler support to automatically move a by-value argument if it's used only once, but it might take months or years until we see this happen...
std/functional.d
Outdated
|
||
/// | ||
@safe unittest | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it would be nicer for the reader to have the simple example first before he has to start diving into the full-blown one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do
Since it's been a month, I've found another use case internally, so I'm adding it now. |
Ehm you could you git rebase upstream/master |
Sorry, my bad. Of course. |
So I rebased and squashed to one commit and maybe we can get a second pairs? |
Reviewer roulette: @ZombineDev @CyberShadow @schveiguy @burner |
Okay - I am going to merge this if there's no veto in the next seven days ;-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@property auto fwd(){ return move(arg); } | ||
|
||
static if (args.length == 1) | ||
alias forward = fwd; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this to avoid a template instantiation in the case where args.length == 1
? If so, I wouldn't think it'd matter that much.
@wilzbach You forgot something here :-) |
Let's first make sure this is not a breaking change, by waiting for a green Jenkins. The last error is unrelated, but before that this run https://ci.dlang.io/blue/organizations/jenkins/dlang-org%2Fphobos/detail/PR-5348/3/pipeline looks like it might have failed because of this PR. |
@wilzbach What is the status of this? |
Thanks for your pull request, @radcapricorn! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Some tips to help speed things up:
Bear in mind that large or tricky changes may require multiple rounds of review and revision. Please see CONTRIBUTING.md for more information. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
I think this just stalled due to spurious Jenkins failures. Let's see whether this still is the case... |
Per discussion, augment std.functional.forward to: