Git Product home page Git Product logo

scala-reactive's People

Watchers

James Cloos avatar Maxim Karvonen avatar

scala-reactive's Issues

Lifecycle management: Support 'very dirty' function application.

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.

Lifecycle management: Better support for proxying in complex scenarios

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.