英文名:The Implicit Calculus
Extended Report: The Implicit Calculus
摘要:
泛型编程(GP)是程序设计语言中一个日益重要的趋势。众所周知的GP机制,如类型类和C++0x概念提案,通常结合了两个特性:1)特殊类型的接口; 2)这些接口实现的隐式实例化。Scala隐式实例化是一种GP语言机制,受类型类的启发,打破了将隐式实例化与特殊类型的接口耦合的传统。相反,隐式实例化只提供隐式实例化,它被一般化为适用于任何类型。事实证明,这对于解决其他GP机制中出现的许多限制非常强大和有用。本文将隐式语言的核心思想形式化地综合到一个最小的、通用的核心演算中,称为隐式演算,并展示了如何在此基础上构建支持隐式实例化的源语言。隐式演算的一个新颖之处在于它支持部分解析和高阶规则(这一特性以前曾被提出,但从未被形式化或实现)。最终,隐式演算提供了一个形式化的隐式演算模型,语言设计者可以使用它来研究和通知在他们自己的语言中实现类似的机制。
英文摘要:
Generic programming (GP) is an increasingly important trend in programming languages. Well-known GP mechanisms, such as type classes and the C++0x concepts proposal, usually combine two features: 1) a special type of interfaces; and 2) implicit instantiation of implementations of those interfaces. Scala implicits are a GP language mechanism, inspired by type classes, that break with the tradition of coupling implicit instantiation with a special type of interface. Instead, implicits provide only implicit instantiation, which is generalized to work for any types. This turns out to be quite powerful and useful to address many limitations that show up in other GP mechanisms. This paper synthesizes the key ideas of implicits formally in a minimal and general core calculus called the implicit calculus, and it shows how to build source languages supporting implicit instantiation on top of it. A novelty of the calculus is its support for partial resolution and higher-order rules (a feature that has been proposed before, but was never formalized or implemented). Ultimately, the implicit calculus provides a formal model of implicits, which can be used by language designers to study and inform implementations of similar mechanisms in their own languages.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。