maxkar / scala-reactive Goto Github PK
View Code? Open in Web Editor NEWReactive programming library for the scala language
Reactive programming library for the scala language
Consider following fragment:
case class Model(va : Behaviour[Int], vb : Behaviour[Int]);
def sum(a : Int)(b : Int) : Int = a + b;
def dirtyFn(cond : Boolean)(va : Model)(vb : Model)(optional???) : Behaviour[Int] = {
if (cond)
sum _ :> va.a :> vb.b
else
sum _ :> va.b :> vb.a
}
val cond : Behaviour[Boolean] = ...
val va : Behaviour[Model] = ...
val vb : Behaviour[Model] = ...
val session = new Session()
val testVal : Behaviour[Int] = dirtyFn _ :> cond :> va :~>> vb
// doSomething with cond, va, vb, va.value.a, va.value.b, vb.value.a, vb.value.b
session.destroy();
After destroying the session all associations between testVal and (cond, va, vb, va.value.a, va.value.b, vb.value.a, vb.value.b) and all intermediate nodes should be destroyed. Changes to va or vb should remove all references to unused .value. values (no unintentional retentions even for intermediate results) and create new (actual) relations. I.e. only minimal number of relations should be maintained and all unnecessary relations should be removed after the session cleanup. As dirtyFn is already aware of Reactive behaviour, it can receive some additional arguments to cooperate with the library.
Need to support following scenario.
def doSomething(model : Behaviour[Behavior[T]]) : Unit = {
implicit val session = new Session();
val x : Behavior[T] = ?? (flatten(model));
doSomethingWith(x);
session.destroy();
}
At the end of the code I want that x have no association neither with model nor with model.value. I.e. model should have same dependants as it had before calling this method. proxy(model) will remove only dependency from model but not from model.value. It is possible to create an inner proxy for model.value and manually manage it, but I want some OOB solution for this kind of problems.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.