scalatwitterfinagletwitter-finagletwitter-util

What are advantages of a Twitter Future over a Scala Future?


I know a lot of reasons for Scala Future to be better. Are there any reasons to use Twitter Future instead? Except the fact Finagle uses it.


Solution

  • Disclaimer: I worked at Twitter on the Future implementation. A little bit of context, we started our own implementation before Scala had a "good" implementation of Future.

    Here're the features of Twitter's Future:

    e.g. Just one example: Future.join(f1, f2) can work on heterogeneous Future types.

    Future.join(
      Future.value(new Object), Future.value(1)
    ).map {
      case (o: Object, i: Int) => println(o, i)
    }
    

    o and i keep their types, they're not casted into the least common supertype Any.

    #1 is guaranteed to be executed before #2