So in some cases you have (int) and in others (unit,int). I can reason on that :)
As one example, if you have no mutable state, there's no chance of a race condition caused by another thread mutating some state underneath you. In Haskell, you can't mutate state, though in Scala you rely on being careful not to use any mutable state.
-
-
I don't have to worry about var state = State...() being raced in an actor because actors by definition prevent that.
-
In Scala (well, Akka), actors don't really offer you much protection, actually. They just give you a model which helps manage mutable state by conventions rather than compiler guarantees. Again, not so convincing.
- Show replies
New conversation -
-
-
So in Scala, the compiler guarantees it, iff you're careful, so it's not such a compelling guarantee. In Haskell, you're forced to write things in ways which many programmers would find awkward, but the guarantees are there.
-
As in my other tweets, I use Scala in a very immutable way, but not entirely immutable because actors save me some problems by preventing races. Still, I prefer to use a case class to maintain immutable state at the instance level because it frees my mind from mutability burden.
- Show replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.