tindzk / MetaRx

Reactive data structures for Scala and Scala.js
35 stars 13 forks source link

Support for WriteChannel[Numeric].toLong etc. #40

Open mkotsbak opened 9 years ago

mkotsbak commented 9 years ago

From issue #27.

Also toDouble etc. should be supported. Example (given #28 implemented): val lat = Var(63.0) .. span("Lat: "), text().attach(lat.toDouble),

Hmm, toDouble should work with WriteChannel too and be bidirectional?

As it is already defined for ReadChannel, maybe it must be added to WriteChannel too, or replace the implementation in Channel[Numeric].

tindzk commented 8 years ago

I'm not entirely convinced because one of MetaRx's design goals is to provide generic operations. If we add toLong, many other operations will become necessary. To implement what you need, you could simply use biMap().

If you think this feature would have many use cases, we could discuss introducing a package ext for non-standard extensions. Then the user can do an import ext.Numeric._ to make this functionality available.