Precise concrete type inference for object-oriented languages

1994 ◽  
Vol 29 (10) ◽  
pp. 324-340 ◽  
Author(s):  
John Plevyak ◽  
Andrew A. Chien
2008 ◽  
Vol 18 (3) ◽  
pp. 285-331 ◽  
Author(s):  
CHIERI SAITO ◽  
ATSUSHI IGARASHI ◽  
MIRKO VIROLI

AbstractFamily polymorphism has been proposed for object-oriented languages as a solution to supporting reusable yet type-safe mutually recursive classes. A key idea of family polymorphism is the notion of families, which are used to group mutually recursive classes. In the original proposal, due to the design decision that families are represented by objects, dependent types had to be introduced, resulting in a rather complex type system. In this article, we propose a simpler solution oflightweightfamily polymorphism, based on the idea that families are represented by classes rather than by objects. This change makes the type system significantly simpler without losing much expressive power of the language. Moreover, “family-polymorphic” methods now take a form of parametric methods; thus, it is easy to apply method type argument inference as in Java 5.0. To rigorously show that our approach is safe, we formalize the set of language features on top of Featherweight Java and prove that the type system is sound. An algorithm for type inference for family-polymorphic method invocations is also formalized and proved to be correct. Finally, a formal translation by erasure to Featherweight Java is presented; it is proved to preserve typing and execution results, showing that our new language features can be implemented in Java by simply extending the compiler.


1992 ◽  
Vol 21 (385) ◽  
Author(s):  
Nicholas Oxhøj ◽  
Jens Palsberg ◽  
Michael I. Schwartzbach

We present the implementation of a type inference algorithm for untyped object-oriented programs with inheritance, assignments, and late binding.The algorithm significantly improves our previous one, presented at OOPSLA'91, since it can handle collection classes, such as {\bf List}, in a useful way. Also, the complexity has been dramatically improved, from exponential time to low polynomial time. The implementation uses the techniques of incremental graph construction and constraint template instantiation to avoid representing intermediate results, doing superfluous work, and recomputing type information. Experiments indicate that the implementation type checks as much as 100 lines pr. second. This results in a mature product, on which a number of tools can be based, for example a safety tool, an image compression tool, a code optimization tool, and an annotation tool. This may make type inference for object-oriented languages practical.


1995 ◽  
Vol 2 (32) ◽  
Author(s):  
Jens Palsberg

Abadi and Cardelli have recently investigated a calculus of objects<br />[2]. The calculus supports a key feature of object-oriented languages:<br />an object can be emulated by another object that has more refined<br />methods. Abadi and Cardelli presented four first-order type systems<br />for the calculus. The simplest one is based on finite types and no<br />subtyping, and the most powerful one has both recursive types and<br />subtyping. Open until now is the question of type inference, and<br />in the presence of subtyping the absence of minimum typings poses<br />practical problems for type inference [2].<br />In this paper we give an O(n^3) algorithm for each of the four type<br />inference problems and we prove that all the problems are P-complete.<br />We also indicate how to modify the algorithms to handle functions and<br />records.


1995 ◽  
Vol 2 (34) ◽  
Author(s):  
Jens Palsberg

The metavariable self is fundamental in object-oriented languages.<br />Typing self in the presence of inheritance has been studied by Abadi<br />and Cardelli, Bruce, and others. A key concept in these developments<br />is the notion of selftype, which enables flexible type annotations that<br />are impossible with recursive types and subtyping. Bruce et al. demonstrated<br />that, for the language TOOPLE, type checking is decidable.<br />Open until now is the problem of type inference with selftype.<br />In this paper we present a type inference algorithm for a type<br />system with selftype, recursive types, and subtyping. The example<br />language is the object calculus of Abadi and Cardelli, and the type<br />inference algorithm runs in nondeterministic polynomial time.


2009 ◽  
Vol 22 (5) ◽  
pp. 489-535 ◽  
Author(s):  
Adolfo Duran ◽  
Ana Cavalcanti ◽  
Augusto Sampaio

2010 ◽  
Vol 36 (2) ◽  
pp. 123-141 ◽  
Author(s):  
Daniel Fernández Lanvin ◽  
Raúl Izquierdo Castanedo ◽  
Aquilino Adolfo Juan Fuente ◽  
Alberto Manuel Fernández Álvarez

Sign in / Sign up

Export Citation Format

Share Document