摘要
协变-反变问题讨论面向对象语言中继承机制和多态计算的关系,是当前面向对象程序设计语言中的一个重要的理论问题.反变的方法重定义不符合思维习惯,一般采用协变精化的设计方法.但抛弃反变后的面向对象程序设计,在多态计算中会产生类型问题.针对这一问题,该文基于Castagna 的重载函数模型,提出处理协变相关类型问题的类型系统和计算模型,并在ND-Polya 语言及系统中具体实现.该方法可以应用到其它协变面向对象语言中.
The covariance versus contravariance issue, exploring type safety problem caused by the interaction between inheritance and polymorphism, has been, and still is an important problem in current OOPLs. Because contravariant redefinition of method is not consistent with traditional programming style, covariant redefinition of method is preferred to as the mechanism to support specialization. But object oriented programming will introduce type error in polymorphism computation without sticking to contravariance. To solve this problem, this paper proposes a type system and a polymorphism computation model on the basis of the Castagna's theoretical model of overloaded functions, which were implemented in OOPL ND Polya developed by authors and its supporting system. And this method can be applied to other covariant OOPLs.
出处
《计算机学报》
EI
CSCD
北大核心
1999年第9期953-957,共5页
Chinese Journal of Computers
基金
国家自然科学基金
国家杰出青年科学基金
江苏省青年基金