论文标题

具有静态功能和效果的设计:使用,提及和不变性

Designing with Static Capabilities and Effects: Use, Mention, and Invariants

论文作者

Gordon, Colin S.

论文摘要

功能(无论对象还是参考功能)从根本上是限制效果的工具。因此,静态功能(对象或参考)和效果系统将不同的技术机械带到了静态限制或对程序中效果推理的相同核心问题。每当两种方法原则上可以解决相同的问题时,都重要的是要了解方法之间的权衡,这些权衡如何与手头的问题相互作用。 在这些领域工作的专家往往会发现权衡很明显,但以前在上下文中考虑了它们。但是,这种设计讨论通常仅被隐式地写下来,作为特定程序推理问题的两种方法之间的比较,而不是对一般技术之间的一般权衡的讨论。结果,要用一种技术解决问题,而只是找到另一种更适合的问题并不少见。 我们讨论静态功能(特别是参考功能)与效果系统之间的权衡,表达每种方法倾向于孤立面临的挑战,以及如何减轻这些挑战。我们还通过诉诸于在该地区开发先前系统的过程中如何考虑这些权衡的例子来介绍我们的讨论。在此过程中,我们强调了类型系统的看似最小的方面(削弱/框架和单纯的类型上下文的存在)在这些系统的功效中起着微妙的作用。

Capabilities (whether object or reference capabilities) are fundamentally tools to restrict effects. Thus static capabilities (object or reference) and effect systems take different technical machinery to the same core problem of statically restricting or reasoning about effects in programs. Any time two approaches can in principle address the same sets of problems, it becomes important to understand the trade-offs between the approaches, how these trade-offs might interact with the problem at hand. Experts who have worked in these areas tend to find the trade-offs somewhat obvious, having considered them in context before. However, this kind of design discussion is often written down only implicitly as comparison between two approaches for a specific program reasoning problem, rather than as a discussion of general trade-offs between general classes of techniques. As a result, it is not uncommon to set out to solve a problem with one technique, only to find the other better-suited. We discuss the trade-offs between static capabilities (specifically reference capabilities) and effect systems, articulating the challenges each approach tends to have in isolation, and how these are sometimes mitigated. We also put our discussion in context, by appealing to examples of how these trade-offs were considered in the course of developing prior systems in the area. Along the way, we highlight how seemingly-minor aspects of type systems -- weakening/framing and the mere existence of type contexts -- play a subtle role in the efficacy of these systems.

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源