Category: Uncategorized
-
Immutability and Co/Contravariance
After a long long time… Immutability also Empowers Type Safety. There are many reasons to use immutable data structures and you may have heard many of them. For example, immutable data is safe to be shared across multiple threads etc. Apart from all of these awesome benefits, immutability helps us…
-
CRDT: Conflict Free Data Type
Recently, a colleague of mine and I gave a presentation in Lambda Days conference about CRDTs. Its video has just been released, so I decided to dedicate a blog post to it: And here is another version of our talk which has been presented on Curry On conference: And yet another version presented on…
-
Scala Futures with Timeout
Scala Futures do not support built-in timeout unless you block on the future using scala.concurrent.Await as follows: The above code will timeout: java.util.concurrent.TimeoutException: Futures timed out after [1 second] at scala.concurrent.impl.Promise$DefaultPromise.ready(Promise.scala:219) at scala.concurrent.impl.Promise$DefaultPromise.result(Promise.scala:223) at scala.concurrent.Await$anonfun$result$1.apply(package.scala:107) at scala.concurrent.BlockContext$DefaultBlockContext$.blockOn(BlockContext.scala:53) … Sometimes non-blocking external libraries are providing futures as their functions return type…