News for hackers. Stuff that matters.

zephyri

Re:Scala 2.12.0 is now available on Thursday November 03, 2016 @04:52PM (#12867836)
I mean that, in an event loop, synchronous code is blocking code. If you could synchronously run a database query in Node, nothing else would be allowed to execute while you waited. That's why you have to use asynchronous callbacks/promises/generators/await whatever.

In Go I can make an apparently synchronous database query without blocking anything except the calling code.

Re:Scala 2.12.0 is now available on Thursday November 03, 2016 @02:33PM (#12866635)
Go. It's what I love most about it. If something needs to wait for a response, e.g., a database call, your goroutine just pauses without blocking any other goroutine, even if you're running only a single process. You never have to return a promise.

Contrast that with JavaScript where you're forced to use promises/async await. If you don't, you block the whole event loop.

See also "What Color is Your Function": http://journal.stuffwithstuff.com/2015/02/01/what-color-is-y...