Code is referentially transparent if you can replace the definition with its body at any point (in other words, you can replace the reference (in the example
x) with the value (in the example
In the example,
val x = Future.apply(e) would be referentially transparent if you can replace
Future.apply(e) for all
You can’t, you note so yourself:
But they are not the same.
If those are not the same, that’s the definition of them not being referentially transparent.
I don’t see the post claiming that
Future is unsuable in general though, just that the writer of the tweet finds it unusable after being accustomed to a referentially transparent abstraction:
After years of using Scalaz Task, Future is now totally unusable.
implies that before getting accustomed to using
Future wasn’t unusable to them, and it doesn’t really say anything about other people that may find
Future a totally usable abstraction.