We can obtain "-1" by incrementing an int value, proof:
val x = Int.MaxValue
x + Int.MaxValue + 1 // prints "-1"
But if we try to do this via FSM:
import moorka._
def fsm = FSM(0) {
case -1 ⇒ Dummy
case x ⇒ Val(x + 1)
}
We will get:
java.lang.StackOverflowError
at moorka.rx.bindings.package$.bindingStack(scratch_26.scala:9)
at moorka.rx.bindings.Binding$class.withContext(scratch_26.scala:10)
at moorka.rx.FSM.withContext(scratch_26.scala:15)
We can obtain "-1" by incrementing an int value, proof:
But if we try to do this via FSM:
We will get: