On understanding types, data abstraction, and polymorphism

Our objective is to understand the notion of type in programming languages, present a model of typed, polymorphic programming languages that reflects recent research in type theory, and examine the relevance of recent research to the design of practical programming languages. Object-oriented languages provide both a framework and a motivation for exploring the interaction among the concepts of type, data abstraction, and polymorphism, since they extend the notion of type to data abstraction and since type inheritance is an important form of polymorphism. We develop a λ-calculus-based model for type systems that allows us to explore these interactions in a simple setting, unencumbered by complexities of production programming languages. The evolution of languages from untyped universes to monomorphic and then polymorphic type systems is reviewed. Mechanisms for polymorphism such as overloading, coercion, subtyping, and parameterization are examined. A unifying framework for polymorphic type systems is developed in terms of the typed λ-calculus augmented to include binding of types by quantification as well as binding of values by abstraction. The typed λ-calculus is augmented by universal quantification to model generic functions with type parameters, existential quantification and packaging (information hiding) to model abstract data types, and bounded quantification to model subtypes and type inheritance. In this way we obtain a simple and precise characterization of a powerful type system that includes abstract data types, parametric polymorphism, and multiple inheritance in a single consistent framework. The mechanisms for type checking for the augmented λ-calculus are discussed. The augmented typed λ-calculus is used as a programming language for a variety of illustrative examples. We christen this language Fun because fun instead of λ is the functional abstraction keyword and because it is pleasant to deal with. Fun is mathematically simple and can serve as a basis for the design and implementation of real programming languages with type facilities that are more powerful and expressive than those of existing programming languages. In particular, it provides a basis for the design of strongly typed object-oriented languages.

[1]  Niklaus Wirth,et al.  Programming in Modula-2 , 1985, Texts and Monographs in Computer Science.

[2]  John C. Mitchell,et al.  Abstract types have existential types , 1985, POPL.

[3]  Rod M. Burstall,et al.  HOPE: An experimental applicative language , 1980, LISP Conference.

[4]  Robin Milner,et al.  A Theory of Type Polymorphism in Programming , 1978, J. Comput. Syst. Sci..

[5]  WegnerPeter,et al.  On understanding types, data abstraction, and polymorphism , 1985 .

[6]  Renzo Orsini,et al.  GALILEO: a strongly-typed, interactive conceptual language , 1985, TODS.

[7]  J. Fenstad Proceedings of the Second Scandinavian Logic Symposium , 1971 .

[8]  David B. MacQueen Using dependent types to express modular structure , 1986, POPL '86.

[9]  Eric Emerson Schmidt Controlling large software development in a distributed environment , 1982 .

[10]  Alfred V. Aho,et al.  Compilers: Principles, Techniques, and Tools , 1986, Addison-Wesley series in computer science / World student series edition.

[11]  David Robson,et al.  Smalltalk-80: The Language and Its Implementation , 1983 .

[12]  John C. Reynolds,et al.  Towards a theory of type structure , 1974, Symposium on Programming.

[13]  James Hook,et al.  Understanding Russell- A First Attempt , 1984, Semantics of Data Types.

[14]  Robin Milner,et al.  Principal type-schemes for functional programs , 1982, POPL '82.

[15]  John C. Reynolds,et al.  Three Approaches to Type Structure , 1985, TAPSOFT, Vol.1.

[16]  Craig Schaffert,et al.  CLU Reference Manual , 1984, Lecture Notes in Computer Science.

[17]  Nancy McCracken,et al.  The Typechecking of Programs with Implicit Type Structure , 1984, Semantics of Data Types.

[18]  Robin Milner,et al.  A proposal for standard ML , 1984, LFP '84.

[19]  Thierry Coquand,et al.  Constructions: A Higher Order Proof System for Mechanizing Mathematics , 1985, European Conference on Computer Algebra.

[20]  Gordon D. Plotkin,et al.  An ideal model for recursive polymorphic types , 1984, Inf. Control..

[21]  Peter Wegner On the unification of data and program abstraction in Ada , 1983, POPL '83.

[22]  Luca Cardelli,et al.  Basic Polymorphic Typechecking , 1987, Sci. Comput. Program..

[23]  David C. J. Matthews,et al.  Poly manual , 1985, SIGP.

[24]  David A. Moon,et al.  The Lisp Machine manual , 1981, SGAR.

[25]  C. A. R. Hoare,et al.  Ambiguities and insecurities in pascal , 1977, Softw. Pract. Exp..

[26]  Graham Beech,et al.  Software engineering with ada , 1983 .

[27]  Kim B. Bruce,et al.  The Semantics of Second Order Polymorphic Lambda Calculus , 1984, Semantics of Data Types.

[28]  Luca Cardelli,et al.  A Semantics of Multiple Inheritance , 1984, Inf. Comput..

[29]  Marvin H. Solomon,et al.  Type definitions with parameters , 1978, POPL.

[30]  John Mitchell,et al.  Type Inference and Type Containment , 1984, Semantics of Data Types.

[31]  Dana S. Scott,et al.  Data Types as Lattices , 1976, SIAM J. Comput..

[32]  Butler W. Lampson,et al.  A Kernel Language for Abstract Data Types and Modules , 1984, Semantics of Data Types.

[33]  R. Hindley The Principal Type-Scheme of an Object in Combinatory Logic , 1969 .

[34]  Robin Milner,et al.  Edinburgh LCF , 1979, Lecture Notes in Computer Science.

[35]  David B. MacQueen Modules for standard ML , 1984, LFP '84.

[36]  Per Martin-Löf,et al.  Intuitionistic type theory , 1984, Studies in proof theory.

[37]  J. Fairbairn,et al.  Ponder and its type system , 1982 .

[38]  J. Girard Une Extension De ĽInterpretation De Gödel a ĽAnalyse, Et Son Application a ĽElimination Des Coupures Dans ĽAnalyse Et La Theorie Des Types , 1971 .

[39]  J. A. Robinson,et al.  A Machine-Oriented Logic Based on the Resolution Principle , 1965, JACM.