Êtes-vous un étudiant de l'EPFL à la recherche d'un projet de semestre?
Travaillez avec nous sur des projets en science des données et en visualisation, et déployez votre projet sous forme d'application sur Graph Search.
A large part of software written today is reactive. In contrast to batch mode systems, a reactive program continuously adapts itself to new input which often requires a substantial amount of engineering. Traditionally, reactive programs are implemented in terms of callbacks. This approach leads to an inversion of control, which makes it hard to reason about control- and data flow. A number of programming models have been proposed to improve on callbacks, most prominently constraint imperative programming (CIP) and functional reactive programming (FRP). Both approaches have their individual advantages and limitations. CIP often handles multi-way data flow well but some event handling logic is difficult to express and data flow sometimes difficult to predict. In FRP, data flow is predictable but restricted to a single direction. Complex event logic can become complicated and the programmer is sometimes forced to escape the functional programming model imposed by FRP. Existing CIP and FRP implementations do not support incremental changes. Declarative programming with time-varying data structures therefore quickly becomes inefficient. In this thesis, we propose a reactive programming model that is functional reactive at its core but allows the programmer to escape the functional reactive paradigm when necessary. It improves on previous FRP systems and also on CIP in a number of ways. Our implementation, Scala.React, supports all host language expressions without special adaptation. We provide an imperative data flow language that simplifies the processing of complex event patterns. A user of Scala.React can safely use callbacks or a variant of callbacks that reduces inversion of control if a more declarative solution is not obvious. Our reactive sequence data structure propagates incremental changes. It supports both first-order reactivity by means of composition similar to functional collections via map, filter, fold and alike, as well as higher-order reactivity with support for time-varying collection elements. Reactive lenses provide a way to declaratively program with multi-way reactive data flow that allows for local reasoning and is therefore predictable. All of these abstractions are implemented on top of a general propagation system that guarantees data consistency, supports atomic updates, and provides isolation of different reactive parts of a program. The core system is extensible and abstracts from the details of individual abstractions.
Aurélien François Gilbert Bloch
, ,