paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Effect Handlers for C via Coroutines

基于协程的 C 语言效应处理器
OOPSLA 8(OOPSLA2)2024匹配度 1/10 · 该论文属于函数式编程与语言设计方向,研究 C 语言的效应处理器库与协程实现,未涉及用户关注的核心方向:静态分析、LLM/Agent、浮点程序分析或贝叶斯程序分析。虽然同属 PL 领域,但与用户画像中的 AI×PL 交叉及具体分析对象均无直接关联。引用 8 inbox
Mario Alvarez-Picallo, Teodoro Freund, Dan R. Ghica, Sam Lindley
dblp: 2026-09-10crossref: 2026-09-10

AI 速览

一句话:提出 libseff:面向 C 的基于协程的效应处理器库,可直接在 C 程序中使用且性能有竞争力。

效应处理器为异常、生成器和轻量级线程等用户自定义、可组合、可定制的计算效应提供结构化实现方式。已有面向 C 的效应处理器库多作为编译目标,而 libseff 旨在供 C 程序直接使用。为此,它偏离传统实现:以可变协程作为待完成计算的主要表示,并通过具体化效应(reified effects)避免将闭包用作处理器。论文在多种平台和基准上评估 libseff,表明其性能具有竞争力。

问题
如何为 C 提供可直接使用的、结构化且可组合的用户自定义计算效应,而不仅作为编译目标。
方法
libseff 基于协程实现效应处理器,用可变协程表示待完成计算,并以具体化效应避免闭包式处理器。
评估
在多种平台上通过一系列基准测试与现有实现对比,显示 libseff 性能具有竞争力。
原文摘要(Abstract)

Effect handlers provide a structured means for implementing user-defined, composable, and customisable computational effects, ranging from exceptions to generators to lightweight threads. We introduce libseff , a novel effect handlers library for C, based on coroutines. Whereas prior effect handler libraries for C are intended primarily as compilation targets, libseff is intended to be used directly from C programs. As such, the design of libseff parts ways from traditional effect handler implementations, both by using mutable coroutines as the main representation of pending computations, and by avoiding closures as handlers by way of reified effects. We show that the performance of libseff is competitive across a range of platforms and benchmarks.

链接与引用

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

BibTeX
@article{Alvarez-Picallo24,
  title = {Effect Handlers for C via Coroutines},
  author = {Mario Alvarez-Picallo and Teodoro Freund and Dan R. Ghica and Sam Lindley},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {8},
  number = {OOPSLA2},
  year = {2024},
  doi = {10.1145/3689798}
}