arXivDaily arXiv每日学术速递 周一至周五更新
北美退伍军人节(Veterans Day),12 日无更新
arXiv 2512.09412cs.PL
收藏

功能反应式编程的简单模态类型

Simple Modal Types for Functional Reactive Programming

IT University of Copenhagen(哥本哈根信息技术大学)

Patrick Bahr

AI总结:

本文提出了一种简化模态类型系统的功能反应式编程语言,通过改进信号语义提升语言表达力和效率。

摘要:

功能反应式编程(FRP)是一种用于在较高抽象层次上实现反应式程序的声明式编程范式。它将函数式编程原则应用于构造和操作随时间变化的值,也称为信号。然而,为了使这种编程范式在实践中有效,FRP语言必须确保程序具有因果性、生产力以及无空间泄漏。在过去十五年中,已开发出几种模态类型系统以强制这些操作属性。我们提出了一种新的FRP语言,其显著简化了模态类型系统,比以前的模态FRP语言施加的限制更少,同时仍保证因果性、生产力和无空间泄漏的核心操作属性。关键的使能思想是改变信号的语义,使类型系统能够安全地允许更多程序通过类型检查,从而使语言更具表现力。通过这种新的语义,信号被建模为可变引用,其可变性由'later'类型模态严格控制。这种纪律性的可变性也使信号能够更高效地进行原地更新,同时保持函数式编程风格。

英文摘要:

Functional reactive programming (FRP) is a declarative programming paradigm for implementing reactive programs at a high level of abstraction. It applies functional programming principles to construct and manipulate time-varying values, also known as signals. However, for this programming paradigm to work in practice, an FRP language must ensure that programs are causal, productive, and free of space leaks. Over the past fifteen years, several modal type systems to enforce these operational properties have been developed. We present a new FRP language with a significantly simplified modal type system that imposes fewer restrictions than previous modal FRP languages while still guaranteeing the central operational properties of causality, productivity, and absence of space leaks. The key enabling idea is to define the language's semantics so that it is impossible to inspect a signal's past. In particular, a signal only stores its current value and how to compute its future values, but it cannot retain its past values. As a result, we obtain a language with a simpler modal type system that is also more expressive and supports a more modular programming style compared to previous modal FRP calculi without space leaks. While the central idea applies to both synchronous and asynchronous FRP, we focus here on the more challenging asynchronous case.

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

↑