|
ABSTRACT
Traditional techniques for implementing polymorphism use a universal representation for objects of unknown type. Often, this forces a compiler to use universal representations even if the types of objects are known. We examine an alternative approach for compiling polymorphism where types are passed as arguments to polymorphic routines in order to determine the representation of an object. This approach allows monomorphic code to use natural, efficient representations, supports separate compilation of polymorphic definitions and, unlike coercion-based implementations of polymorphism, natural representations can be used for mutable objects such as refs and arrays.We are particularly interested in the typing properties of an intermediate language that allows run-time type analysis to be coded within the language. This allows us to compile many representation transformations and many language features without adding new primitive operations to the language. In this paper, we provide a core target language where type-analysis operators can be coded within the language and the types of such operators can be accurately tracked. The target language is powerful enough to code a variety of useful features, yet type checking remains decidable. We show how to translate an ML-like language into the target language so that primitive operators can analyze types to produce efficient representations. We demonstrate the power of the “user-level” operators by coding flattened tuples, marshalling, type classes, and a form of type dynamic within the language.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
 |
1
|
M. Abadi , L. Cardelli , B. Pierce , G. Plotkin, Dynamic typing in a statically-typed language, Proceedings of the 16th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, p.213-227, January 11-13, 1989, Austin, Texas, United States
[doi> 10.1145/75277.75296]
|
 |
2
|
|
 |
3
|
Alexander Aiken , Edward L. Wimmers , T. K. Lakshman, Soft typing with conditional types, Proceedings of the 21st ACM SIGPLAN-SIGACT symposium on Principles of programming languages, p.163-173, January 16-19, 1994, Portland, Oregon, United States
[doi> 10.1145/174675.177847]
|
| |
4
|
S. F. Allen, R. L. Constable, D. J. Howe, and W. E. Aitken. The semantics of reflected proof. In Fifth Symposium on Logic in Computer Science, pages 95-106, Philadelphia, PA, June 1990. IEEE.
|
| |
5
|
|
 |
6
|
Guy E. Blelloch , Jonathan C. Hardwick , Siddhartha Chatterjee , Jay Sipelstein , Marco Zagha, Implementation of a portable nested data-parallel language, Proceedings of the fourth ACM SIGPLAN symposium on Principles and practice of parallel programming, p.102-111, May 19-22, 1993, San Diego, California, United States
|
| |
7
|
|
| |
8
|
L. Cardelli. Phase distinctions in type theory. Unpublished manuscript.
|
| |
9
|
L. Cardelli. Typeful programming. Technical Report 45, DEC Systems Research Center, 1989.
|
 |
10
|
|
 |
11
|
Dominique Clément , Thierry Despeyroux , Gilles Kahn , Joëlle Despeyroux, A simple applicative language: mini-ML, Proceedings of the 1986 ACM conference on LISP and functional programming, p.13-27, August 1986, Cambridge, Massachusetts, United States
[doi> 10.1145/319838.319847]
|
| |
12
|
R. L. Constable. Intensional analysis of functions and types. Technical Report CSR-t18-82, Computer Science Department, University of Edinburgh, June 1982.
|
 |
13
|
|
| |
14
|
D. Duggan and J. Ophel. Kinded parametric overloading. Technical Report CS-94-35, University of Waterloo, Department of Computer Science, September 1994. Supersedes CS-94-15 and CS-94-16, March 1994, and CS-93-32, August 1993.
|
| |
15
|
H. Friedman. Equality between functionals. In R. Parikh, editor, Logic Colloquium '75, Studies in Logic and the Foundations of Mathematics, pages 22-37. North-Holland, 1975.
|
| |
16
|
J.-Y. Girard. Une extension de l'interpr#tation de Ghdel t# l'analyse, et son application k l'dlimination des coupures dans l'analyse et la th#orie des types. In J. E. Fenstad, editor, Proceedings of the Second Scandinavian Logic Symposium, Studies in Logic and the Foundations of Mathematics, pages 63-92. North-Holland, 1971.
|
| |
17
|
J.-Y. Girard. Interprdtation Fonctionnelle et t#limination des Coupures dans I'Arithmdtique d'Ordre Supdrieure. PhD thesis, Universit6 Paris VII, 1972.
|
| |
18
|
K. Ghdel. Uber eine bisher noch nicht benfitzte Erweiterung des finiten Standpunktes. Dialectica, 12:280-287, 1958.
|
| |
19
|
|
 |
20
|
|
 |
21
|
|
| |
22
|
|
 |
23
|
|
 |
24
|
|
 |
25
|
Paul Hudak , Simon Peyton Jones , Philip Wadler , Brian Boutel , Jon Fairbairn , Joseph Fasel , María M. Guzmán , Kevin Hammond , John Hughes , Thomas Johnsson , Dick Kieburtz , Rishiyur Nikhil , Will Partain , John Peterson, Report on the programming language Haskell: a non-strict, purely functional language version 1.2, ACM SIGPLAN Notices, v.27 n.5, p.1-164, May 1992
[doi> 10.1145/130697.130699]
|
| |
26
|
M. Jones. Coherence for qualified types. Research Report YALEU/DCS/RR-989, Yale University, New Haven, Connecticut, USA, September 1993.
|
| |
27
|
M. Jones. Partial evaluation for dictionary-free overloading. In A CM Conference on Partial Evaluation and Semantics- Based Program Manipulation, 1994.
|
| |
28
|
|
| |
29
|
|
 |
30
|
|
| |
31
|
P. Martin-LSf. About models for intuitionistic type theories and the notion of definitional equality. In S. Kanger, editor, Proceedings of the Third Scandinavian Logic Symposium, Studies in Logic and the Foundations of Mathematics, pages 81-109. North-Holland, 1975.
|
| |
32
|
R. Milner. A theory of type polymorphism in programming languages. Journal of Computer and System Sciences, 17:348-375, 1978.
|
| |
33
|
|
 |
34
|
|
 |
35
|
|
| |
36
|
G. Morrisett, M. Felleisen, and R. Harper. Abstract models of memory management. In preparation, Oct. 1994.
|
 |
37
|
|
 |
38
|
|
 |
39
|
|
| |
40
|
G. Plotkin. Lambda-definabiIity in the full type hierarchy. In J. P. Seldin and J. R. Hindley, editors, To H. B. Curry: Essays in Combinatory Logic, Lambda Calculus and Formalism, pages 363-373. Academic Press, 1980.
|
| |
41
|
E. R. Poulsen. Representation analysis for efficient implementation of polymorphism. Technical report, Department of Computer Science (DIKU), University of Copenhagen, Apr. 1993. Master Dissertation.
|
| |
42
|
|
| |
43
|
|
 |
44
|
|
| |
45
|
R. Statman. Completeness, invariance, and lambdadefinability. Journal o/ Symbolic Logic, 47:17-26, 1982.
|
| |
46
|
R. Statman. Logical relations and the typed .k-calculus. In. formation and Control, 65:85-97, 1985.
|
| |
47
|
S. Stenlund. Combinators, )#-terms and Proof Theory. D. Reidel, 1972.
|
| |
48
|
W.W. Tait. Intensional interpretation of functionals of finite type. Journal o/Symbolic Logic, 32(2):187-199, June 1967.
|
 |
49
|
|
 |
50
|
|
 |
51
|
|
| |
52
|
A. K. Wright. Polymorphism for imperative languages without imperative types. Technical Report TR93-200, Department of Computer Science, Rice University, Houston, TX, Feb. 1993. To appear, Lisp and Symbolic Computation.
|
 |
53
|
|
CITED BY 97
|
|
|
|
|
Greg Morrisett , Matthias Felleisen , Robert Harper, Abstract models of memory management, Proceedings of the seventh international conference on Functional programming languages and computer architecture, p.66-77, June 26-28, 1995, La Jolla, California, United States
|
|
|
Martin Odersky , Philip Wadler , Martin Wehr, A second look at overloading, Proceedings of the seventh international conference on Functional programming languages and computer architecture, p.135-146, June 26-28, 1995, La Jolla, California, United States
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
D. Tarditi , G. Morrisett , P. Cheng , C. Stone , R. Harper , P. Lee, TIL: a type-directed optimizing compiler for ML, ACM SIGPLAN Notices, v.31 n.5, p.181-192, May 1996
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Karl Crary , David Walker , Greg Morrisett, Typed memory management in a calculus of capabilities, Proceedings of the 26th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, p.262-275, January 20-22, 1999, San Antonio, Texas, United States
|
|
|
Simon Peyton Jones , Mark Shields , John Launchbury , Andrew Tolmach, Bridging the gulf: a common intermediate language for ML and Haskell, Proceedings of the 25th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, p.49-61, January 19-21, 1998, San Diego, California, United States
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Yasuhiko Minamide , Greg Morrisett , Robert Harper, Typed closure conversion, Proceedings of the 23rd ACM SIGPLAN-SIGACT symposium on Principles of programming languages, p.271-283, January 21-24, 1996, St. Petersburg Beach, Florida, United States
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
David Tarditi , Greg Morrisett , Perry Cheng , Chris Stone , Robert Harper , Peter Lee, TIL: a type-directed, optimizing compiler for ML, ACM SIGPLAN Notices, v.39 n.4, April 2004
|
|
|
David Tarditi , Greg Morrisett , Perry Cheng , Chris Stone , Robert Harper , Peter Lee, TIL: a type-directed, optimizing compiler for ML, ACM SIGPLAN Notices, v.39 n.4, April 2004
|
|
|
|
|
|
|
|
|
|
|
|
Dimitrios Vytiniotis , Geoffrey Washburn , Stephanie Weirich, An open and shut typecase, Proceedings of the 2005 ACM SIGPLAN international workshop on Types in languages design and implementation, p.13-24, January 10-10, 2005, Long Beach, California, USA
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Martin Sulzmann , Manuel M. T. Chakravarty , Simon Peyton Jones , Kevin Donnelly, System F with type equality coercions, Proceedings of the 2007 ACM SIGPLAN international workshop on Types in languages design and implementation, January 16-16, 2007, Nice, Nice, France
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Arjun Guha , Jacob Matthews , Robert Bruce Findler , Shriram Krishnamurthi, Relationally-parametric polymorphic contracts, Proceedings of the 2007 symposium on Dynamic languages, October 22-22, 2007, Montreal, Quebec, Canada
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Iulian Dragos , Martin Odersky, Compiling generics through user-directed type specialization, Proceedings of the 4th workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems, p.42-47, July 06-06, 2009, Genova, Italy
|
|
|
|
|
|
|
|
|
|
|
|
|
|