Unifying Genericity - Combining the Benefits of Virtual Types and Parameterized Classes

Unifying Genericity - Combining the Benefits of Virtual Types and Parameterized Classes
复制标题

统一通用性 - 结合虚拟类型和参数化类的优点

DOI:
10.1007/3-540-48743-3_9
复制
发表时间:
1999
期刊:
Proc. IEEE
影响因子:
--
通讯作者:
Mads Torgersen
Mads Torgersen
中科院分区:
--
文献类型:
--
作者:
Kresten Krab Thorup;Mads Torgersen

文献摘要

被引文献

相似文献

编程语言中的通用类型通常受到各种形式的参数多态性的支持,即对类型的功能。在面向对象的语言的框架内,虚拟类型提出了一种替代类型,其中特定类型是使用继承而不是函数应用程序从通用类型中得出的。尽管两种机制在静态上都是安全的,并且支持基本的通用性,但它们具有非常不同的键入属性,它们都提供了描述有用关系的描述,而这些关系与其他关系不可表达。在本文中,我们通过使用示例来介绍一种描述通用类的机制:结构虚拟类型。这种机制本质上是参数化类和虚拟类型的合并,包括同时的好处,尤其是虚拟类型的相互递归和协方差以及参数化类的功能样性质。
Generic types in programming languages are most often supported with various forms of parametric polymorphism, i.e. functions on types. Within the framework of object-oriented languages, virtual types present an alternative where specific types are derived from generic ones using inheritance rather than function application. While both mechanisms are statically safe and support basic genericity, they have very different typing properties, each of them providing for the description of useful relationships, which are not expressible with the other. In this paper we present, through the use of examples, a mechanism for describing generic classes: structural virtual types. This mechanism is essentially a merger of parameterized classes and virtual types and includes the bene fits of both, in particular retaining mutual recursion and covariance of virtual types as well as the function-like nature of parameterized classes.