[关闭]
@atry 2017-04-09T12:34:38.000000Z 字数 795 阅读 1491

Reactive Monad, done right.


Abstract

Most of the reactive framework provide subscribe and unsubscribe methods on reactive objects for event handling. Reactive systems built from these frameworks will leak memory or duplicate events if the users do not properly call unsubscribe. However, in complex reactive system, it is difficult to determine the timing to unsubscribe.

Some reactive frameworks have the concept of ownership, which aims to automatically unsubscribe an object when its owner is killed. Unfortunately, this approach does not work for complicated diamond dependencies.

In Binding.scala, we introduce a new approach that encapsulates reactive objects into a pure Monad with no side-effect. Event listeners are managed internally by Binding.scala runtime, and there is no public subscribe or unsubscribe method for users.

As a result, a reactive system built with Binding.scala never leaks memory or duplicate events.

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注