Type inference for variant object types

被引:3
|
作者
Bugliesi, M [1 ]
Pericás-Geertsen, SM
机构
[1] Univ Ca Foscari Venezia, Dipartimento Informat, Venice, Italy
[2] Boston Univ, Dept Comp Sci, Boston, MA 02215 USA
关键词
Algorithms - Computational complexity - Computer programming languages - Constraint theory - Program diagnostics - Theorem proving;
D O I
10.1006/inco.2002.3091
中图分类号
TP301 [理论、方法];
学科分类号
081202 ;
摘要
Existing type systems for object calculi are based on invariant subtyping. Subtyping invariance is required for soundness of static typing in the presence of method overrides, but it is often in the way of the expressive power of the type system. Flexibility of static typing can be recovered in different ways: in first-order systems by the adoption of object types with variance annotations, in second-order systems by resorting to Self types. Type inference is known to be P-complete for first-order systems of finite and recursive object types, and NP-complete for a restricted version of Self types. The complexity of type inference for systems with variance annotations is yet unknown. This paper presents a new object type system based on the notion of Split types, a form of object types where every method is assigned two types, namely, an update type and a select type. The subtyping relation that arises for Split types is variant and, as a result, subtyping can be performed both in width and in depth. The new type system generalizes all the existing first-order type systems for objects, including systems based on variance annotations. Interestingly, the additional expressive power does not affect the complexity of the type inference problem, as we show by presenting an 0(n(3)) inference algorithm. (C) 2002 Elsevier Science (USA).
引用
收藏
页码:2 / 27
页数:26
相关论文
共 50 条
  • [1] EFFICIENT INFERENCE OF OBJECT TYPES
    PALSBERG, J
    [J]. INFORMATION AND COMPUTATION, 1995, 123 (02) : 198 - 209
  • [2] Type inference with constrained types
    Odersky, M
    Sulzmann, M
    Wehr, M
    [J]. THEORY AND PRACTICE OF OBJECT SYSTEMS, 1999, 5 (01): : 35 - 55
  • [3] Type Inference for Correspondence Types
    Gordon, Andrew D.
    Huttel, Hans
    Hansen, Rene Rydhof
    [J]. ELECTRONIC NOTES IN THEORETICAL COMPUTER SCIENCE, 2009, 242 (03) : 21 - 36
  • [4] TYPE INFERENCE WITH PARTIAL TYPES
    THATTE, SR
    [J]. THEORETICAL COMPUTER SCIENCE, 1994, 124 (01) : 127 - 148
  • [5] TYPE INFERENCE WITH PARTIAL TYPES
    THATTE, S
    [J]. LECTURE NOTES IN COMPUTER SCIENCE, 1988, 317 : 615 - 629
  • [6] An Interval-Based Inference of Variant Parametric Types
    Craciun, Florin
    Chin, Wei-Ngan
    He, Guanhua
    Qin, Shengchao
    [J]. PROGRAMMING LANGUAGES AND SYSTEMS, PROCEEDINGS, 2009, 5502 : 112 - +
  • [7] OBJECT-ORIENTED TYPE INFERENCE
    PALSBERG, J
    SCHWARTZBACH, MI
    [J]. SIGPLAN NOTICES, 1991, 26 (11): : 146 - 161
  • [8] TYPE INFERENCE FOR PARTIAL TYPES IS DECIDABLE
    OKEEFE, PM
    WAND, M
    [J]. LECTURE NOTES IN COMPUTER SCIENCE, 1992, 582 : 408 - 417
  • [9] Type inference for nested self types
    Bono, V
    Tiuryn, J
    Urzyczyn, P
    [J]. TYPES FOR PROOFS AND PROGRAMS, 2004, 3085 : 99 - 114
  • [10] Function types in complete type inference
    Widera, M
    Beierle, C
    [J]. TRENDS IN FUNCTIONAL PROGRAMMING 3, 2002, : 111 - 122