skip to main content
research-article

An error-tolerant type system for variational lambda calculus

Published:09 September 2012Publication History
Skip Abstract Section

Abstract

Conditional compilation and software product line technologies make it possible to generate a huge number of different programs from a single software project. Typing each of these programs individually is usually impossible due to the sheer number of possible variants. Our previous work has addressed this problem with a type system for variational lambda calculus (VLC), an extension of lambda calculus with basic constructs for introducing and organizing variation. Although our type inference algorithm is more efficient than the brute-force strategy of inferring the types of each variant individually, it is less robust since type inference will fail for the entire variational expression if any one variant contains a type error. In this work, we extend our type system to operate on VLC expressions containing type errors. This extension directly supports locating ill-typed variants and the incremental development of variational programs. It also has many subtle implications for the unification of variational types. We show that our extended type system possesses a principal typing property and that the underlying unification problem is unitary. Our unification algorithm computes partial unifiers that lead to result types that (1) contain errors in as few variants as possible and (2) are most general. Finally, we perform an empirical evaluation to determine the overhead of this extension compared to our previous work, to demonstrate the improvements over the brute-force approach, and to explore the effects of various error distributions on the inference process.

References

  1. S. Anantharaman, P. Narendran, and M. Rusinowitch. Unification Modulo ACUI Plus Homomorphisms/Distributivity. Journal of Automated Reasoning, 33:1--28, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. S. Apel and C. Kästner. An Overview of Feature-Oriented Software Development. Journal of Object Technology, 8(5):49--84, 2009.Google ScholarGoogle ScholarCross RefCross Ref
  3. F. Baader and W. Snyder. Unification Theory. In A. Robinson and A. Voronkov, editors, Handbook of Automated Reasoning, chapter 8, pages 445--533. Elsevier Science Publishers, Amsterdam, NL, 2001.Google ScholarGoogle ScholarCross RefCross Ref
  4. D. Batory, J. N. Sarvela, and A. Rauschmayer. Scaling Step-Wise Refinement. IEEE Trans. on Software Engineering, 30(6):355--371, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. S. Chen, M. Erwig, and E. Walkingshaw. Extending Type Inference to Variational Programs. Technical Report, School of EECS, Oregon State University, 2012. Available at: http://eecs.oregonstate.edu/~erwig/ToSC/VLC-TypeSystem.pdf.Google ScholarGoogle Scholar
  6. L. Damas and R. Milner. Principal Type Schemes for Functional Programming Languages. In 9th ACM Symp. on Principles of Programming Languages, pages 207--208, 1982. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. M. Dezani-Ciancaglini, S. Ghilezan, and B. Venneri. The "Relevance" of Intersection and Union Types. Notre Dame Journal of Formal Logic, 38(2):246--269, 1997.Google ScholarGoogle ScholarCross RefCross Ref
  8. M. Erwig and E. Walkingshaw. The Choice Calculus: A Representation for Software Variation. ACM Trans. on Software Engineering and Methodology, 21(1):6:1--6:27, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. GHC. The Glasgow Haskell Compiler. http://haskell.org/ghc.Google ScholarGoogle Scholar
  10. K. Kagawa. Polymorphic Variants in Haskell. In ACM SIGPLAN Workshop on Haskell, pages 37--47. ACM, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. C. Kästner, S. Apel, T. Thüm, and G. Saake. Type Checking Annotation-Based Product Lines. ACM Trans. on Software Engineering and Methodology, 2012. To appear. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. A. Kenner, C. Kästner, S. Haase, and T. Leich. TypeChef: Toward Type Checking #ifdef Variability in C. In Int. Workshop on Feature-Oriented Software Development, pages 25--32, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. C. H. P. Kim, C. Kästner, and D. Batory. On the Modularity of Feature Interactions. In Int. Conf. on Generative Programming and Component Engineering, pages 19--23, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. D. Kozen, J. Palsberg, and M. I. Schwartzbach. Efficient Inference of Partial Types. In Journal of Computer and System Sciences, pages 363--371, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. B. S. Lerner, M. Flower, D. Grossman, and C. Chambers. Searching for Type-Error Messages. In ACM Conf. on Programming Language Design and Implementation, pages 425--434, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. M. Mezini and K. Ostermann. Variability Management with Feature-Oriented Programming and Aspects. ACM SIGSOFT Software Engineering Notes, 29(6):127--136, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. P. M. O'Keefe and M. Wand. Type Inference for Partial Types is Decidable. In European Symp. on Programming, pages 408--417, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. B. C. Pierce. Bounded Quantification with Bottom. Technical report, Computer Science Department, Indiana University, 1997.Google ScholarGoogle Scholar
  19. B. C. Pierce. Types and Programming Languages. MIT Press, Cambridge, MA, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. K. Pohl, G. Böckle, and F. van der Linden. Software Product Line Engineering: Foundations, Principles, and Techniques. Springer-Verlang, Berlin Heidelberg, 2005. Google ScholarGoogle ScholarCross RefCross Ref
  21. J. A. Robinson. A Machine-Oriented Logic Based on the Resolution Principle. Journal of the ACM, 12(1):23--41, 1965. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. J. G. Siek and W. Taha. Gradual Typing for Functional Languages. In Scheme and Functional Programming Workshop, pages 81--92, 2006.Google ScholarGoogle Scholar
  23. J. G. Siek and M. Vachharajani. Gradual Typing with Unification-Based Inference. In Symp. on Dynamic Languages, pages 7:1--7:12, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. W. Taha and T. Sheard. MetaML and Multi-Stage Programming with Explicit Annotations. Theoretical Computer Science, 248(1-2):211--242, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. S. Thaker, D. Batory, D. Kitchin, and W. Cook. Safe Composition of Product Lines. In Int. Conf. on Generative Programming and Component Engineering, pages 95--104, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. S. Thatte. Type Inference with Partial Types. In Int. Colloq. on Automata, Languages and Programming, pages 615--629, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. E. Tiden and S. Arnborg. Unification Problems with One-Sided Distributivity. Journal of Symbolic Computation, 3(1-2):183--202, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. M. Wand. Finding the Source of Type Errors. In ACM Symp. on Principles of Programming Languages, pages 38--43, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. An error-tolerant type system for variational lambda calculus

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!