paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Compositional Programming

组合式编程(Compositional Programming)
TOPLAS 43(3)2021匹配度 1/10 · 该论文属于编程语言设计与类型系统,核心是组合式编程、Expression Problem 与模块化,并未涉及用户关注的静态分析、Agentic/LLM、浮点程序分析或贝叶斯程序分析。虽然同属 PL 领域,但与该研究画像的具体问题方向基本无关。引用 23 inbox
Weixin Zhang, Yaozhu Sun, Bruno C. D. S. Oliveira
crossref: 2026-09-10

AI 速览

一句话:提出静态类型的组合式编程风格与 CP 语言,用组合式接口、trait、方法模式等概念同时解决表达式问题与模块化依赖。

模块性与可扩展性一直是编程语言的核心难题:表达式问题(EP)揭示了大多数语言只能在新增变体与新增操作之间二选一,而以模块化方式表达复杂依赖同样困难。本文提出一种新的静态类型模块化编程风格——组合式编程(Compositional Programming)。该风格从根本上消解了 EP:可以同时在多个维度上扩展,既能方便地新增变体,也能方便地新增操作。它提供了一条不同于函数式代数数据类型与面向对象类层次的建模路径,并引入四个关键概念:组合式接口、组合式 trait、方法模式与嵌套 trait 组合。基于这些概念,作者设计了语言 CP,可用于建模类似属性文法的程序,并自然地处理具有复杂依赖的模块化程序,文中通过多个示例与三个案例研究进行说明,并证明了该语言是类型安全的。

问题
现有编程语言在模块性与可扩展性上受限:表达式问题使语言难以同时支持新增变体与新增操作,模块化地表达程序各部分之间的复杂依赖也很困难。
方法
提出组合式编程风格与语言 CP,引入组合式接口、组合式 trait、方法模式与嵌套 trait 组合四个机制,以静态类型系统支撑多维度扩展与模块化依赖建模。
评估
通过若干示例与三个案例研究展示该风格在解决表达式问题、建模属性文法式程序及处理复杂模块依赖上的能力,并给出 CP 语言的类型安全性证明。
原文摘要(Abstract)

Modularity is a key concern in programming. However, programming languages remain limited in terms of modularity and extensibility. Small canonical problems, such as the Expression Problem (EP), illustrate some of the basic issues: the dilemma between choosing one kind of extensibility over another one in most programming languages. Other problems, such as how to express dependencies in a modular way, add up to the basic issues and remain a significant challenge. This article presents a new statically typed modular programming style called Compositional Programming . In Compositional Programming, there is no EP: It is easy to get extensibility in multiple dimensions (i.e., it is easy to add new variants as well as new operations). Compositional Programming offers an alternative way to model data structures that differs from both algebraic datatypes in functional programming and conventional OOP class hierarchies. We introduce four key concepts for Compositional Programming: compositional interfaces , compositional traits , method patterns , and nested trait composition . Altogether, these concepts allow us to naturally solve challenges such as the Expression Problem, model attribute-grammar-like programs, and generally deal with modular programs with complex dependencies . We present a language design, called CP , which is proved to be type-safe, together with several examples and three case studies.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot1213,
  title = {Compositional Programming},
  author = {Weixin Zhang and Yaozhu Sun and Bruno C. D. S. Oliveira},
  journal = {ACM Transactions on Programming Languages and Systems},
  volume = {43},
  number = {3},
  year = {2021},
  doi = {10.1145/3460228}
}