These are chat archives for ThoughtWorksInc/Binding.scala

Mar 2016
杨博 (Yang Bo)
Mar 16 2016 03:34
@Jegp BindingInstances is an internal data structure. I did not expect it being used by manually written code.
This message was deleted
杨博 (Yang Bo)
Mar 16 2016 03:40

I think you can simply use for/yield on Vars.

val prefix = new Var("ForYield")
val source = Vars(1, 2, 3)
val mapped = (for {
  sourceElement <- source
  i <- Constants((0 until sourceElement): _*)
} yield {
  raw"""${prefix.each} $i/$sourceElement"""


Note that data-binding is disabled by default. You must call watch() after you setup all binding expressions.
Jens Egholm
Mar 16 2016 07:10
@Atry Thanks mate. That makes much more sense. I just skimmed the documentation for something that could map the structure. But this makes much more sense
Hey, and thanks for all the great work. I really like your library as an alternative to all the other reactive frameworks
Jens Egholm
Mar 16 2016 16:22
Just one short question. Since your aggregating into constants, is it possible to map further from here on? Or would the changes not be registered in the binding?
Hrm.. I really need to read up on my monads.
So a more specific question could be; if I'd like to extract the sequence to perform some calculation on it reactively, how would you do this within your framework? I assume a for..yield isn't going to cut it because there's no way to escape from the monad scope.