If only project Loom will get out there so I wont be coding everything like Javascript I'd be happy. :)
If only project Loom will get out there so I wont be coding everything like Javascript I'd be happy. :)
https://journal.stuffwithstuff.com/2015/02/01/what-color-is-...
Spring is worst thing happened with Java.
It's very difficult to write generic, reusable higher-order code that shouldn't care if it's doing a sync or async operation. Java at least is building a foundation in the right direction.
[0] - https://journal.stuffwithstuff.com/2015/02/01/what-color-is-...
Just spawning a thread with a scope which will fork them at the end is just better from every conceivable way. Easier to grasp, easier to maintain, easier to debug - all of which are quite important when concurrency is at the table.
The problem with async is that we can separate when to start a task and when to ask for its result. The compiler can just add await everywhere an async function is called, it is trivial, but you don't get the flexibility of async. If everything is treated as async, you will need to await everything (perhaps some syntactic sugar to allow for immediate await)
In go you work rather differently. You let tasks go off and do their thing, and provide a channel to communicate. Pulling a response from the channel is the 'await'. A good part of go's magic is that these tasks - goroutines - don't result in large amount of blocked threads.
Java will soon have the building blocks of something rather similar to goroutines.