ABSTRACT
We show that standard formulations of intersection type systems are unsound in the presence of computational effects, and propose a solution similar to the value restriction for polymorphism adopted in the revised definition of Standard ML. It differs in that it is not tied to let-expressions and requires an additional weakening of the usual subtyping rules. We also present a bi-directional type-checking algorithm for the resulting language that does not require an excessive amount of type annotations and illustrate it through some examples. We further show that the type assignment system can be extended to incorporate parametric polymorphism. Taken together, we see our system and associated type-checking algorithm as a significant step towards the introduction of intersection types into realistic programming languages. The added expressive power would allow many more properties of programs to be stated by the programmer and statically verified by a compiler.
References
- 1.A. Aiken, E. Wimmers, and T. K. Lakshman. Soft typing with conditional types. In Twenty-First ACM Symposium on Principles of Programming Languages (POPL'94), pages 163-173, Portland, Oregon, Jan. 1994. Google Scholar
- 2.V. Breazu-Tannen, T. Coquand, C. Gunter, and A. Scedrov. Inheritance as implicit coercion. Information and Computation, 93:172-221, 1991. Google Scholar
- 3.L. Cardelli. Type systems. In A. B. Tucker, Jr., editor, The Handbook of Computer Science and Engineering, chapter 103, pages 2208-2236. CRC Press, 1997.Google Scholar
- 4.R. Davies. A practical renement-type checker for Standard ML. In M. Johnson, editor, Algebraic Methodology and Software Technology Sixth International Conference (AMAST'97), pages 565-566, Sydney, Australia, Dec. 1997. Springer-Verlag LNCS 1349. Google Scholar
- 5.R. Davies. Practical renement-type checking. Thesis Proposal, Carnegie Mellon University Computer Science Department, Nov. 1997. http://www.cs.cmu.edu/~rowan/papers/proposal.ps Google Scholar
- 6.T. Freeman. Renement Types for ML. PhD thesis, Carnegie-Mellon University, Mar. 1994. Available as technical report CMU-CS-94-110. Google Scholar
- 7.T. Freeman and F. Pfenning. Renement types for ML. In Proceedings of the SIGPLAN '91 Symposium on Language Design and Implementation, Toronto, Ontario, pages 268-277. ACM Press, June 1991. Google Scholar
- 8.R. Harper and C. Stone. A type-theoretic interpretation of Standard ML. In G. Plotkin, C. Stirling, and M. Tofte, editors, Proof, Language, and Interaction: Essays in Honour of Robin Milner. MIT Press, 2000. Google Scholar
- 9.X. Leroy. Polymorphism by name. In Twentieth ACM Symposium on Principles of Programming Languages (POPL'93), pages 220-231, Charleston, South Carolina, January 1993. Google Scholar
- 10.R. Milner, M. Tofte, R. Harper, and D. MacQueen. The Definition of Standard ML(Revised). MIT Press, 1997. Google Scholar
- 11.J. C. Mitchell. Polymorphic type inference and containment. Information and Computation, 76(2/3):211{249, 1988. Google Scholar
- 12.B. C. Pierce. Intersection types and bounded polymorphism. Mathematical Structures in Computer Science, 7(2):129-193, Apr. 1997. Google Scholar
- 13.B. C. Pierce and D. N. Turner. Local type inference. In The 25th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL'98), pages 252-265, San Diego, California, 1998. Google Scholar
- 14.J. C. Reynolds. Preliminary design of the programming language Forsythe. Technical Report CMU-CS-88-159, Carnegie Mellon University, Pittsburgh, Pennsylvania, June 1988.Google Scholar
- 15.J. C. Reynolds. Design of the programming language Forsythe. Technical Report CMU-CS-96-146, Carnegie Mellon University, Pittsburgh, Pennsylvania, June 1996.Google Scholar
- 16.J. Tiuryn and P. Urzyczyn. The subtyping problem for second-order types is undecidable. In Proceedings, 11thAnnual IEEE Symposium on Logic in Computer Science, pages 74-85, New Brunswick, New Jersey, 27-30 July 1996. IEEE Computer Society Press. Google Scholar
- 17.M. Tofte. Type inference for polymorphic references. Information and Computation, 89:1-34, November 1990. Google Scholar
- 18.J. B. Wells. The undecidability ofMitchell's subtyping relation. Technical Report 95-019, Boston University, Boston, Massachusetts, December 1995.Google Scholar
- 19.J. B. Wells, A. Dimock, R. Muller, and F. Turbak. A typed intermediate language for ow-directed compilation. In TAPSOFT'97: Theory and Practice of Software Development, Proc. 7th International Joint Conference CAAP/FASE, pages 757-771, Lille, France, Apr. 1997. Springer-Verlag LNCS 1214. Google Scholar
- 20.A. K. Wright. Simple imperative polymorphism. Information and Computation, 8:343-55, 1995. Google Scholar
- 21.A. K. Wright and R. Cartwright. A practical soft type system for Scheme. In Proceedings of the 1994 ACM Conference on LISP and Functional Programming, pages 250-262, Orlando, Florida, June 1994. Google Scholar
- 22.A. K. Wright and M. Felleisen. A syntactic approach to type soundness. Information and Computation, 115:38-94, 1994. Google Scholar
Index Terms
Intersection types and computational effects






Comments