Don't use Capture as a return value
See original GitHub issueBy returning Capture (or future thereof) we have the burden to preserve type safety. If the change this we can let the client handle this in a safer and easier way:
Capture<List<String>> capture = Capture.empty();
http.get("/").dispatch(series(),
on(SUCCESSFUL).call(capture),
anySeries().call(fail))
.get(10, SECONDS);
capture.retrieve(); // throws NotReadyException vs EmptyException
Benefits
- completely type safe
- no unsafe casts
- easy to understand for clients
- API is now 100% callbacks
- does not even need to be part of the core API (even though it probably will)
This will complete get rid of the problematic of #114.
- externalize into own module:
riptide-capture
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Is there any reason to capture a return-value as an rvalue ...
auto&& means, in a sense, "just make it work, and don't do extra work", and it could deduce to a Foo&& . auto...
Read more >Lambda expressions (since C++11) - cppreference.com
A lambda expression can use a variable without capturing it if the ... If trailing-return-type is not present, the return type of the ......
Read more >The Python return Statement: Usage and Best Practices
In this step-by-step tutorial, you'll learn how to use the Python return statement when writing functions. Additionally, you'll cover some good programming ...
Read more >Returning a Value from a Method (The Java™ Tutorials ...
Within the body of the method, you use the return statement to return the value. Any method declared void doesn't return a value....
Read more >Closures: Anonymous Functions that Capture Their Environment
We'll first examine h ow we can use closures to capture values from t h e ... a closure wit h out any...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The factory method for that could be in Capture already:
There will be cases where clients want a synchronous response, in those cases a callback-style API is not very user friendly. This is the reason why we have capture in the first place. I see it as a usability extension to make synchronous return values easier.