Settable and non-interfering signal functions for FRP

Settable and non-interfering signal functions for FRP
复制标题

FRP 可设置且无干扰的信号功能

DOI:
--
复制
发表时间:
2014
期刊:
ACM SIGPLAN International Conference on Functional Programming
影响因子:
--
通讯作者:
P. Hudak
P. Hudak
中科院分区:
--
文献类型:
--
作者:
Daniel Winograd;P. Hudak

文献摘要

被引文献

相似文献

函数反应式编程 (FRP) 提供了一种利用信号函数对连续反应式系统进行编程的方法,该信号函数抽象地将连续输入信号转换为连续输出信号。这些信号也可能是事件流,实际上,通过允许信号函数本身成为这些事件所携带的值(本质上是信号函数的信号),人们可以通过“切换”进和出这些信号函数来方便地对程序行为进行离散的更改。这种高阶切换概念在许多 FRP 系统中很常见,特别是那些基于箭头的系统,例如 Yampa。尽管很方便,但切换的力量通常是一种杀伤力,并且可能会给某些类型的程序优化(例如因果交换箭头[14])带来问题,因为它会导致程序的结构在运行时动态变化。如果没有即时编译的概念或相关的想法(其本身就存在问题),则在编译时不可能进行此类优化。本文介绍了两种新想法,在大多数情况下无需进行切换。第一个是带有选择的箭头的无干扰定律,允许箭头化的 FRP 程序动态地改变其自身的结构(在静态有限范围内)并放弃未使用的流。另一个想法是可设置信号函数的概念,它允许信号函数捕获其当前状态,然后从某个先前的状态重新启动。凭借这两个功能,高阶切换器的规范使用可以用合适的一阶设计代替,从而实现更广泛的静态优化。
Functional Reactive Programming (FRP) provides a method for programming continuous, reactive systems by utilizing signal functions that, abstractly, transform continuous input signals into continuous output signals. These signals may also be streams of events, and indeed, by allowing signal functions themselves to be the values carried by these events (in essence, signals of signal functions), one can conveniently make discrete changes in program behavior by "switching" into and out of these signal functions. This higher-order notion of switching is common among many FRP systems, in particular those based on arrows, such as Yampa. Although convenient, the power of switching is often an overkill and can pose problems for certain types of program optimization (such as causal commutative arrows [14]), as it causes the structure of the program to change dynamically at run-time. Without a notion of just-in-time compilation or related idea, which itself is beset with problems, such optimizations are not possible at compile time. This paper introduces two new ideas that obviate, in a predominance of cases, the need for switching. The first is a non-interference law for arrows with choice that allows an arrowized FRP program to dynamically alter its own structure (within statically limited bounds) as well as abandon unused streams. The other idea is a notion of a settable signal function that allows a signal function to capture its present state and later be restarted from some previous state. With these two features, canonical uses of higher-order switchers can be replaced with a suitable first-order design, thus enabling a broader range of static optimizations.