MetaRx icon indicating copy to clipboard operation
MetaRx copied to clipboard

Complex Algorithms

Open darkfrog26 opened this issue 9 years ago • 1 comments

It would be incredible if MetaRx could support even more complex algorithms with more advanced logic via Macros. For example, something like this:

val sub: Sub[Double] = Sub(0.0)
sub := subscribe {
  if (otherVar.get > 5.0) {
    otherVar + anotherVar
  } else {
    anotherVar
  }
}

The Macro would track all ReadChannel instances used within the block and update the resulting ReadChannel generated from the subscribe call. This would allow things like for-loops, conditionals, etc. to be used with simple logic, but become a ReadChannel that would fire events when any dependency changed.

darkfrog26 avatar Jun 01 '16 03:06 darkfrog26

see also https://github.com/lihaoyi/scala.rx for inspiration, the Rx { code } syntax is similiar to this feaure

fkz avatar Aug 07 '16 18:08 fkz