-
Notifications
You must be signed in to change notification settings - Fork 388
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
Consider reordering arguments for Async* member functions. #1543
Comments
@dopiera @houglum @roopak-qlogic @manish-qlogic @deepankarsharma PTAL. Comments (or simply up/down votes) are welcome. |
If there are no opinions by 2018-12-07 I am going to consider this proposal accepted. |
upvote! |
This seems reasonable, LGTM. W.r.t. readability and passing a lambda in the middle args vs. at the end: As an alternative to creating it inline in the list of args, I'd imagine you could declare the lambda outside of the arg list, then pass its name as an argument (via
|
As described in googleapis#1543, it seems better to move the arguments for a `Async*()` function to be ```C++ AsyncBlah(CompletionQueue& cq, Functor&& callback, Foo) ``` This fixes googleapis#1543.
In the original design document I recommended that a function like:
type1 Function(type2 a, type3 b);
was converted to an asynchronous version by (amongst other changes) appending two arguments:
That works poorly for functions that have default parameters:
or with variadic arguments:
I propose we change the order of the arguments to have the completion queue and the functor at the beginning:
The downside is that calling the function with a lambda at the end is more readable (most of the time):
The text was updated successfully, but these errors were encountered: