arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1803.02796cs.PLcs.LO
收藏

资源多态性

Resource Polymorphism

Guillaume Munch-Maccagnoni

摘要:

我们提出了一个ML风格的程序设计语言,旨在与OCaml的哲学和运行时模型兼容的资源管理模型。这是一个用析构函数、移动语义和资源多态性扩展OCaml语言的提议,以提高其安全性、效率、互操作性和表达能力。它建立在系统程序设计语言(Cyclone,C++11,Rust)的所有权和借用模型以及函数式编程中的线性类型(Linear Lisp,Clean,Alms)之上。它继续从贝克发起的系统编程和线性逻辑资源的综合资源。它是许多已知和一些新想法的结合。在新颖的一面,它突出了Stroustrup的“资源获取即初始化”(RAII)习语的良好数学结构,用于基于析构函数的资源管理,这个概念有时与终结器混淆,并在此基础上建立了一个资源多态性的概念,灵感来自证明理论中的极化,它混合了C++的RAII和跟踪垃圾收集器(GC)。该提案针对设计空间中的一个新点,具有自动和可预测的资源管理模型,同时基于轻量级和表达性语言抽象。它是向后兼容的:当前的代码被期望以相同的性能运行,新的抽象与当前的完全结合,并且它支持库的资源多态扩展。它只对运行时做了一些添加,并且与当前的GC实现集成。它也与即将到来的多核扩展兼容,并建议使用Rust模型来消除数据竞争。对于一个安全和实用的类型系统,出现了一些有趣的问题,其中许多已经在语言和原型Cyclone,Rust和Alms中进行了彻底的研究。

英文摘要:

We present a resource-management model for ML-style programming languages, designed to be compatible with the OCaml philosophy and runtime model. This is a proposal to extend the OCaml language with destructors, move semantics, and resource polymorphism, to improve its safety, efficiency, interoperability, and expressiveness. It builds on the ownership-and-borrowing models of systems programming languages (Cyclone, C++11, Rust) and on linear types in functional programming (Linear Lisp, Clean, Alms). It continues a synthesis of resources from systems programming and resources in linear logic initiated by Baker. It is a combination of many known and some new ideas. On the novel side, it highlights the good mathematical structure of Stroustrup's "Resource acquisition is initialisation" (RAII) idiom for resource management based on destructors, a notion sometimes confused with finalizers, and builds on it a notion of resource polymorphism, inspired by polarisation in proof theory, that mixes C++'s RAII and a tracing garbage collector (GC). The proposal targets a new spot in the design space, with an automatic and predictable resource-management model, at the same time based on lightweight and expressive language abstractions. It is backwards-compatible: current code is expected to run with the same performance, the new abstractions fully combine with the current ones, and it supports a resource-polymorphic extension of libraries. It does so with only a few additions to the runtime, and it integrates with the current GC implementation. It is also compatible with the upcoming multicore extension, and suggests that the Rust model for eliminating data-races applies. Interesting questions arise for a safe and practical type system, many of which have already been thoroughly investigated in the languages and prototypes Cyclone, Rust, and Alms.

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

↑