arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1803.10199cs.PL
收藏

用Java的轻量级扩展协调信号和事件

Harmonizing Signals and Events with a Lightweight Extension to Java

Tetsuo Kamina, Tomoyuki Aotani

摘要:

当前对与周围环境无缝连接的需求使软件更具反应性。例如,这种需求在由物联网组成的系统中是显而易见的。这样的系统包括响应于外部或内部事件而周期性地更新的一组反应值,以在这样的更新被传播到其他反应值的意义上形成反馈流。实现这种反应值的两种有效方法已经被提出:基于事件编程中的事件机制和函数反应编程中的信号。这两种方法现在在几种语言中混合使用,如Flaptrix和REScala,这使得这些语言在模块化反应式软件实现方面表现突出。例如,REScala提供了一个丰富的API,其中包含将事件转换为信号的函数,反之亦然。在本文中,我们探索另一种更简单的方法在反应式程序设计语言的设计空间:事件机制与信号相协调,从而简化编程接口,主要是基于信号。基于这种方法,我们实现了SignalJ,一个简单的扩展Java的事件和信号。我们值得注意的发现是(1)事件可以表示为信号的更新,(2)这样一个有效的信号可以使用注释来表示,而不是为信号引入类型和构造函数,以进一步简化语言。本文的另一个贡献是SignalJ的形式化模型。由于事件和信号的机制可能相互干扰,这种混合有时会导致令人惊讶的行为。例如,信号的功能行为受到事件的命令性特征的影响。因此,理解这种混合的形式模型实际上很重要。核心演算,Featherweight SignalJ(FSJ),开发作为Featherweight Java的扩展,并提供证明,以确保FSJ的可靠性。

英文摘要:

The current demands for seamless connections with the surrounding environment make software more reactive. For example, such demands are evident in systems consisting of the Internet of Things. Such systems include a set of reactive values that are periodically updated in response to external or internal events to form a dataflow in the sense that such updates are propagated to other reactive values. Two effective approaches for realizing such reactive values have been proposed: the event mechanisms in event-based programming and the signals in functional-reactive programming. These two approaches are now becoming mixed in several languages such as Flapjax and REScala, which makes these languages notably expressive for modularizing the implementation of reactive software. For example, REScala provides a rich API that consists of functions converting events to signals and vice versa. In this paper, we explore another, simpler approach in the design space of reactive programming languages: the event mechanism is harmonized with signals, resulting in a simplified programming interface that is mostly based on signals. Based on this approach, we realize SignalJ, a simple extension of Java with events and signals. Our notable findings are (1) an event can be represented as an update of a signal and (2) such an effectful signal can be represented using annotations instead of introducing types and constructors for signals to further simplify the language. Another contribution of this paper is the formal model of SignalJ. As both mechanisms of events and signals may interfere with each other, this mixing sometimes results in surprising behavior. For example, the functional behavior of signals is affected by the imperative features of events. Thus, understanding the formal model of this mixing is actually important. The core calculus, Featherweight SignalJ (FSJ), was developed as an extension of Featherweight Java, and proofs are provided to ensure the soundness of FSJ.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑