phaller / reactive-async

Expressive deterministic concurrency in Scala
BSD 2-Clause "Simplified" License
15 stars 9 forks source link

Check monotonicity of whenNext callback #88

Open JanKoelzer opened 6 years ago

JanKoelzer commented 6 years ago

For whenNext without threshold, results must always increase, if input increases. This has to be checked at runtime. Use a table to store previous inputs/outputs. Use #86 on a new result every and every entry to check this property.

JanKoelzer commented 6 years ago

This can easily be added to NextDepRunnable but is hard to check, if a callback is used for both whenNext and whenComplete:

val f = …
c1.whenNext(c2, f)
c1.whenComplete(c2, f) // same callback here

Maybe we could disapprove this usage in favor of when and implement the check in the implementation of when. All callback results would need to be stored in a cell's state Map[otherCell, Map[inV, outcome]]. On the other hand, check, if this feature is needed anymore, if we use a MonotonicUpdater.