Complex software systems often feature distinct modes of operation, each designed to handle a particular scenario that may require the system to respond in a certain way. Breaking down system behavior into mutually exclusive modes and discrete transitions between modes is a commonly used strategy to reduce implementation complexity and promote code readability. However, such capabilities often come in the form of self-contained domain specific languages or language-specific frameworks. The work in this paper aims to bring the advantages of modal models to mainstream programming languages, by following the polyglot coordination approach of Lingua Franca (LF), in which verbatim target code (e.g., C, C++, Python, Typescript, or Rust) is encapsulated in composable reactive components called reactors. Reactors can form a dataflow network, are triggered by timed as well as sporadic events, execute concurrently, and can be distributed across nodes on a network. With modal models in LF, we introduce a lean extension to the concept of reactors that enables the coordination of reactive tasks based on modes of operation. The implementation of modal reactors outlined in this paper generalizes to any LF-supported language with only modest modifications to the generic runtime system.
翻译:复杂的软件系统往往具有不同的操作模式,每个系统都设计用于处理可能要求系统以某种方式作出反应的特定情景。将系统行为分为相互排斥的模式和模式之间的互不关联的转换是常用的战略,以减少执行复杂性和促进代码可读性。然而,这种能力往往以自成一体的域域特定语言或语言特定框架的形式出现。本文件的工作旨在通过采用Lingua Franca(LF)的多球形协调方法,将模式模型的优势纳入主流程序语言,在这种方法中,目标代码(例如,C、C++、Python、Stystrict或Rust)包含在可比较的反应性反应组件中,称为反应堆。反应堆可以形成数据流网络,由时间和零星事件引发,同时执行,并且可以在网络上的节点中分布。在LF的模型模型中,我们精细扩展反应堆的概念,以便能够根据操作方式协调反应性任务。本文中概述的模型反应堆的安装情况,一般为任何可折叠的常规语言系统。