Practical Variable-Arity Polymorphism

  • T. Stephen Strickland
  • Sam Tobin-Hochstadt
  • Matthias Felleisen
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5502)

Abstract

Just as some functions have uniform behavior over distinct types, other functions have uniform behavior over distinct arities. These variable-arity functions are widely used in scripting languages such as Scheme and Python. Statically typed languages also accommodate modest forms of variable-arity functions, but even ML and Haskell, languages with highly expressive type systems, cannot type check the wide variety of variable-arity functions found in untyped functional languages. Consequently, their standard libraries contain numerous copies of the same function definition with slightly different names.

As part of the Typed Scheme project—an on-going effort to create an explicitly typed sister language for PLT Scheme—we have designed and implemented an expressive type system for variable-arity functions. Our practical validation in the context of our extensive code base confirms the usefulness of the enriched type system.

References

  1. 1.
    Tobin-Hochstadt, S., Felleisen, M.: Interlanguage Migration: From Scripts to Programs. In: DLS 2006, Companion to OOPSLA, pp. 964–974 (2006)Google Scholar
  2. 2.
    Tobin-Hochstadt, S., Felleisen, M.: The Design and Implementation of Typed Scheme. In: POPL, pp. 395–406 (2008)Google Scholar
  3. 3.
    Flatt, M.: PLT MzScheme: Language Manual. Technical Report PLT-TR2008-1-v4.0.2, PLT Scheme Inc. (2008), http://www.plt-scheme.org/techreports/
  4. 4.
    Gansner, E.R., Reppy, J.H.: The Standard ML Basis Library. Cambridge University Press, New York (2002)Google Scholar
  5. 5.
    The GHC Team: The Glasgow Haskell Compiler User’s Guide (2008)Google Scholar
  6. 6.
    Findler, R.B., Felleisen, M.: Contracts for Higher-Order Functions. In: ACM SIGPLAN International Conference on Functional Programming, pp. 48–59 (2002)Google Scholar
  7. 7.
    Pierce, B.C., Turner, D.N.: Local Type Inference. ACM Trans. Program. Lang. Syst. 22(1), 1–44 (2000)CrossRefGoogle Scholar
  8. 8.
    Dybvig, R.K., Hieb, R.: A new approach to procedures with variable arity. Lisp and Symbolic Computation: An International Journal 3(3) (1990)Google Scholar
  9. 9.
    Strickland, T.S., Tobin-Hochstadt, S., Felleisen, M.: Variable-Arity Polymorphism. Technical Report NU-CCIS-08-03, Northeastern University (2008)Google Scholar
  10. 10.
    Girard, J.Y.: Une extension de l’interprétation de Gödel à l’analyse, et son application à l’élimination de coupures dans l’analyse et la théorie des types. In: Fenstad, J.E. (ed.) Proceedings of the Second Scandinavian Logic Symposium, pp. 63–92. North-Holland Publishing Co., Amsterdam (1971)CrossRefGoogle Scholar
  11. 11.
    Gosling, J., Joy, B.: The Java Language Specification, 3rd edn. Addison-Wesley, Reading (2005)MATHGoogle Scholar
  12. 12.
    Dzeng, H., Haynes, C.T.: Type Reconstruction for Variable-Arity Procedures. In: LFP 1994, pp. 239–249. ACM Press, New York (1994)Google Scholar
  13. 13.
    Haynes, C.T.: Infer: A Statically-typed Dialect of Scheme. Technical Report 367, Indiana University (1995)Google Scholar
  14. 14.
    Gregor, D., Järvi, J.: Variadic templates for C++. In: SAC 2007, pp. 1101–1108. ACM Press, New York (2007)Google Scholar
  15. 15.
    Tullsen, M.: The Zip Calculus. In: Backhouse, R., Oliveira, J.N. (eds.) MPC 2000. LNCS, vol. 1837, pp. 28–44. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  16. 16.
    McBride, C.: Faking it: Simulating Dependent Types in Haskell. J. Funct. Program. 12(5), 375–392 (2002)MathSciNetMATHGoogle Scholar
  17. 17.
    Moggi, E.: Arity polymorphism and dependent types. In: APPSEM Workshop on Subtyping and Dependent Types in Programming (July 7, 2000) (invited talk)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2009

Authors and Affiliations

  • T. Stephen Strickland
    • 1
  • Sam Tobin-Hochstadt
    • 1
  • Matthias Felleisen
    • 1
  1. 1.PLT @ Northeastern UniversityUSA

Personalised recommendations