Skip to main content

Polymorphic equality — No tags required

  • Conference paper
  • First Online:
Types in Compilation (TIC 1998)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 1473))

Included in the following conference series:

Abstract

Polymorphic equality is a controversial language construct. While being convenient for the programmer, it has been argued that polymorphic equality (1) invites to violation of software engineering principles, (2) lays a serious burden on the language implementor, and (3) enforces a runtime overhead due to the necessity of tagging values at runtime. We show that neither (2) nor (3) are inherent to polymorphic equality by showing that one can compile programs with polymorphic equality into programs without polymorphic equality in such a way that there is no need for tagging or for runtime type analysis. Also, the translation is the identity on programs that do not use polymorphic equality. Experimental results indicate that even for programs that use polymorphic equality, the translation gives good results.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Andrew Appel. Compiling With Continuations. Cambridge University Press, 1992.

    Google Scholar 

  2. Andrew Appel. A critique of Standard ML. In Journal of Functional Programming, pages 3(4): 391–429, October 1993.

    Article  Google Scholar 

  3. Lars Birkedal, Mads Tofte, and Magnus Vejlstrup. From region inference to von Neumann machines via region representation inference. In 23st ACM Symposium on Principles of Programming Languages, January 1996.

    Google Scholar 

  4. Nikolaj Bjørner. Minimal typing derivations. In ACM Workshop on Standard ML and its Applications, June 1994.

    Google Scholar 

  5. Martin Elsman and Niels Hallenberg. An optimizing backend for the ML Kit using a stack of regions. Student Project, July 1995.

    Google Scholar 

  6. Robert Harper and Chris Stone. An interpretation of Standard ML in type theory. Technical report, Carnegie Mellon University, June 1997. CMU-CS-97-147.

    Google Scholar 

  7. Fritz Henglein and Jesper Jørgensen. Formally optimal boxing. In 21st ACM Symposium on Principles of Programming Languages, pages 213–226, January 1994.

    Google Scholar 

  8. Mark Jones. Dictionary-free overloading by partial evaluation. In ACM Workshop on Partial Evaluation and Semantics-Based Program Manipulation, Orlando, Florida, June 1994.

    Google Scholar 

  9. Xavier Leroy. Unboxed objects and polymorphic typing. In 19th ACM Symposium on Principles of Programming Languages, pages 177–188, 1992.

    Google Scholar 

  10. Xavier Leroy. The Objective Caml system. Software and documentation available on the Web, 1996.

    Google Scholar 

  11. Robin Milner, Mads Tofte, Robert Harper, and David MacQueen. The Definition of Standard ML (Revised). MIT Press, 1997.

    Google Scholar 

  12. Greg Morrisett. Compiling with Types. PhD thesis, School of Computer Science, Carnegie Mellon University, Pittsburgh, PA 15213, December 1995.

    Google Scholar 

  13. Martin Odersky, Philip Wadler, and Martin Wehr. A second look at overloading. In 7’th International Conference on Functional Programming and Computer Architecture, June 1995.

    Google Scholar 

  14. Atsushi Ohori. A Polymorphic Record Calculus and its Compilation. ACM Transactions on Programming Languages and Systems, 17(6), November 1995.

    Google Scholar 

  15. Chris Okasaki. Purely Functional Data Structures. PhD thesis, School of Computer Science, Carnegie Mellon University, Pittsburgh, PA 15213, September 1996.

    Google Scholar 

  16. John Peterson and Mark Jones. Implementing type classes. In ACM Symposium on Programming Language Design and Implementation, June 1993.

    Google Scholar 

  17. Manuel Serrano and Pierre Weis. Bigloo: a portable and optimizing compiler for strict functional languages. In Second International Symposium on Static Analysis, pages 366–381, September 1995.

    Google Scholar 

  18. Zhong Shao. Typed common intermediate format. In 1997 USENIX Conference on Domain-Specific Languages, Santa Barbara, CA, Oct 1997.

    Google Scholar 

  19. Zhong Shao and Andrew Appel. A type-based compiler for Standard ML. Technical report, Yale University and Princeton University, November 1994.

    Google Scholar 

  20. David Tarditi, Greg Morrisett, Perry Cheng, Chris Stone, Robert Harper, and Peter Lee. TIL: A type-directed optimizing compiler for ML. In ACM Symposium on Programming Language Design and Implementation, 1996.

    Google Scholar 

  21. David Tarditi, Greg Morrisett, Perry Cheng, Chris Stone, Robert Harper, and Peter Lee. The TIL/ML compiler: Performance and safety through types. In Workshop on Compiler Support for Systems Software, 1996.

    Google Scholar 

  22. Mads Tofte. Type inference for polymorphic references. Information and Computation, 89(1), November 1990.

    Google Scholar 

  23. Mads Tofte, Lars Birkedal, Martin Elsman, Niels Hallenberg, Tommy Højfeld Olesen, Peter Sestoft, and Peter Bertelsen. Programming with regions in the ML Kit. Technical report, Department of Computer Science, University of Copenhagen, April 1997.

    Google Scholar 

  24. Mads Tofte and Jean-Pierre Talpin. Region-based memory management. Information and Computation, 132(2): 109–176, 1997.

    Article  MATH  MathSciNet  Google Scholar 

  25. Philip Wadler and Stephen Blott. How to make ad-hoc polymorphism less ad hoc. In 16th ACM Symposium on Principles of Programming Languages, January 1989.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Xavier Leroy Atsushi Ohori

Rights and permissions

Reprints and permissions

Copyright information

© 1998 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Elsman, M. (1998). Polymorphic equality — No tags required. In: Leroy, X., Ohori, A. (eds) Types in Compilation. TIC 1998. Lecture Notes in Computer Science, vol 1473. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0055516

Download citation

  • DOI: https://doi.org/10.1007/BFb0055516

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-64925-0

  • Online ISBN: 978-3-540-68308-7

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics