These are chat archives for MetaStack-pl/MetaRx

Nov 2015
Marcin Radoszewski
Nov 21 2015 18:24
This message was deleted

I have another little question - Why '' returns DeltaBuffer? The latter is missing some functionality:

case class Action(name: String)
val actions = Buffer[Action]()

div( => actions.mkString(",")) // this works
div( =>",")) // DeltaBuffer is missing the mkString method so this does not compile

I think that either should return Buffer or DeltaBuffer should actually be a Buffer.

Marius B. Kotsbak
Nov 21 2015 19:06
You are right. It should be implemented, but is more complex probably
Marius B. Kotsbak
Nov 21 2015 19:40
Should be possible for map, but not mapPure
Marius B. Kotsbak
Nov 21 2015 20:12
@tindzk Ideas here?
The reduce operation requires caching the current state
Tim Nieradzik
Nov 21 2015 21:37
@marad Thanks for the question. map() directly manipulates the change stream without creating a new buffer. This is what's desired most of the time. If you want to use some combinators on DeltaBuffer that need the entire state (such as mkString), then you need to buffer the delta stream first, for example:","). For now, you'll have to rewrite mkString with foldLeft because Marius just added support for mkString.
Note that you can even use CSS to render the commas: ul( => li("comma-list"). This is a much cleaner version and allows for more atomic DOM updates.
Marius B. Kotsbak
Nov 21 2015 22:12
But for name, you could as well do it manually with map.