Just discovered this awsome library that I wanted to share with you: 
https://github.com/electronicarts/ea-async
When devlopping with react-native or Flutter I frequently use async/await 
when my app needs to communicate whith a distant server or a local database 
for example. Actually, promises and assync/await are such a powerfull 
concept that it is at the base of reactive programming, popularized by 
react.
So, I always regreted that java do not offer this type of concept as 
promises are so much convenient than having to deal with callbacks for 
complex asynchroneous workflows.
Actually, java made a first move in this direction with Java 8 that 
introduced CompletableFuture but it is so complex to use (seriously this 
API is a mess) that it was totally eclipsed by others Java 8 cool features 
(Lambdas, Streams, JSR 310, ...) and is barely used.
But this library, developped by Electronic Arts, abstract all the 
complexity of the CompletableFuture API and allows you to write async await 
code seamlessly. This way, you no longer have to handle two versions (a 
synchroneaous and an asynchroneous) of your network or native requests 
methods for example.
And where it is quite cool is that this lib is able to re-writte your 
async/await calls at runtime or build time, as you prefer. That means that 
it could very well be integrated into the CN1 build gradle process (so it 
would be directly packed with the CN1 IDE plugins) and we could use 
async/await in CN1 (it would requiere the CompletableFuture API to be 
ported to CN1 first though) !
Wouldn't it be cool?
That is clearly something I will try to do when I find some time ;)

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/e7518d00-a835-4438-b9d1-cbcace9b0143%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to