arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2606.01974cs.PL
收藏

Toka:一种具有显式资源语义的系统编程语言

Toka: A Systems Programming Language with Explicit Resource Semantics

USTC(中国科学技术大学)

Zhonghua Yi

AI总结:

提出一种名为Toka的系统编程语言,通过显式资源语义(Handle-Soul对偶模型)在语法层面分离指针标识与值,从而在保持物理透明性的同时实现编译时内存安全,并降低生命周期标注的认知负担。

摘要:

系统编程语言传统上在物理透明性和编译时内存安全之间存在张力。C++提供直接、零成本的硬件访问,但缺乏严格的安全边界;而Rust在保证安全性的同时,却以复杂的生命周期标注和隐式解引用链为代价。在本文中,我们提出Toka,一种通过显式资源语义在资源管理中建立物理透明性的原生系统编程语言。Toka设计的核心是Handle-Soul对偶(非正式地称为Hat-Soul模型),它在语法层面干净地将指针标识(Handle)与其底层值(Soul)分离。通过强制裸标识符始终表示值(Soul),而显式符号表示指针句柄,Toka消除了重绑定操作与值变异之间的语义歧义。我们详细介绍了Toka的资源形态(支持唯一、共享、借用和原始语义)、其生命周期检查机制以及原型编译器的实现。我们的评估表明,Toka在实现有竞争力的运行时性能和最小二进制大小的同时,大幅降低了生命周期标注的认知开销。

英文摘要:

Systems programming languages traditionally struggle with the tension between physical transparency and compile-time memory safety. C++ provides direct, zero-cost hardware access but lacks strict safety boundaries, whereas Rust guarantees safety at the cost of complex lifetime annotations and implicit dereferencing chains. In this paper, we present Toka, a native systems programming language that establishes physical transparency in resource management via Explicit Resource Semantics. At the core of Toka's design is the Handle-Soul Duality (informally referred to as the Hat-Soul model), which cleanly dissociates pointer identities (Handles) from their underlying values (Souls) at the syntactic level. By enforcing that bare identifiers always represent values (Souls) and explicit sigils represent pointer handles, Toka eliminates the semantic ambiguity between rebind operations and value mutations. We detail Toka's resource morphology (supporting unique, shared, borrowed, and raw semantics), its lifetime checking mechanism, and its implementation of a prototype compiler. Our evaluation demonstrates that Toka achieves competitive runtime performance and minimal binary size while drastically reducing the cognitive overhead of lifetime annotations.

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

↑