Typeful Programming

There exists an identifiable programming style based on the widespread use of type information handled through mechanical typechecking techniques. This typeful programming style is in a sense independent of the language it is embedded in; it adapts equally well to functional, imperative, object-oriented, and algebraic programming, and it is not incompatible with relational and concurrent programming. The main purpose of this paper is to show how typeful programming is best supported by sophisticated type systems, and how these systems can help in clarifying programming issues and in adding power and regularity to languages. We start with an introduction to the notions of types, subtypes and polymorphism. Then we introduce a general framework, derived in part from constructive logic, into which most of the known type systems can be accommodated and extended. The main part of the paper shows how this framework can be adapted systematically to cope with actual programming constructs. For concreteness we describe a particular programming language with advanced features; the emphasis here is on the combination of subtyping and polymorphism. We then discuss how typing concepts apply to large programs, made of collections of modules, and very large programs, made of collections of large programs. We also sketch how typing applies to system programming; an area which by nature escapes rigid typing. In summary, we compare the most common programming styles, suggesting that many of them are compatible with, and benefit from, a typeful discipline. Appears in: Formal Description of Programming Concepts, E.J.Neuhold, M.Paul Eds., Springer-Verlag, 1991. SRC Research Report 45, May 24, 1989. Revised January 1, 1993. © Digital Equipment Corporation 1989,1993. This work may not be copied or reproduced in whole or in part for any commercial purpose. Permission to copy in whole or in part without payment of fee is granted for nonprofit educational and research purposes provided that all such whole or partial copies include the following: a notice that such copying is by permission of the Systems Research Center of Digital Equipment Corporation in Palo Alto, California; an acknowledgment of the authors and individuals contributors to the work; and all applicable portions of the copyright notice. Copying, reproducing, or republishing for any other purpose shall require a license with payment of fee to the Systems Research Center. All rights reserved.

[1]  Niklaus Wirth,et al.  From Modula to Oberon and the programming language Oberon , 1987 .

[2]  Robert A. Kowalski,et al.  Logic for problem solving , 1982, The computer science library : Artificial intelligence series.

[3]  Luca Cardelli,et al.  On understanding types, data abstraction, and polymorphism , 1985, CSUR.

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

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

[6]  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 .

[7]  Alan Mycroft,et al.  A Polymorphic Type System for Prolog , 1984, Logic Programming Workshop.

[8]  John C. Reynolds,et al.  Preliminary design of the programming language Forsythe , 1988 .

[9]  R. Strom,et al.  NIL: An integrated language and system for distributed programming , 1983, SIGPLAN '83.

[10]  D. L. Parnas,et al.  On the criteria to be used in decomposing systems into modules , 1972, Software Pioneers.

[11]  Luca Cardelli,et al.  A semantic basis for quest , 1990, Journal of Functional Programming.

[12]  Andrew M. Pitts,et al.  The theory of constructions: Categorical semantics and topos-theoretic models , 1987 .

[13]  Guy L. Steele,et al.  C, a reference manual , 1984 .

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

[15]  Ronald Morrison,et al.  An Approach to Persistent Programming , 1989, Comput. J..

[16]  Kristen Nygaard,et al.  SIMULA: an ALGOL-based simulation language , 1966, CACM.

[17]  Luca Cardelli,et al.  Types for Data-Oriented Languages , 1988, EDBT.

[18]  Gregory R. Andrews,et al.  Concepts and Notations for Concurrent Programming , 1983, CSUR.

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

[20]  L Long BASIC programming , 1986 .

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

[22]  V. Stavridou,et al.  Abstraction and specification in program development , 1988 .

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

[24]  Craig Schaffert,et al.  Abstraction mechanisms in CLU , 1977, Commun. ACM.

[25]  William R. Cook,et al.  Canning: inheritance is not subtyping , 1990 .

[26]  Bruno Courcelle,et al.  Fundamental Properties of Infinite Trees , 1983, Theor. Comput. Sci..

[27]  D. A. Turner,et al.  Miranda: A Non-Strict Functional language with Polymorphic Types , 1985, FPCA.

[28]  Luca Cardelli,et al.  Abstract Types and the Dot Notation , 1990, Programming Concepts and Methods.

[29]  Glenn Krasner,et al.  Smalltalk-80: bits of history, words of advice , 1983 .

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

[31]  Peter Buneman,et al.  Using Powerdomains to Generalize Relational Databases , 1991, Theor. Comput. Sci..