skip to main content
10.1145/512529.512532acmconferencesArticle/Chapter ViewAbstractPublication PagespldiConference Proceedingsconference-collections
Article

Adoption and focus: practical linear types for imperative programming

Published:17 May 2002Publication History

ABSTRACT

A type system with linearity is useful for checking software protocols andresource management at compile time. Linearity provides powerful reasoning about state changes, but at the price of restrictions on aliasing. The hard division between linear and nonlinear types forces the programmer to make a trade-off between checking a protocol on an object and aliasing the object. Most onerous is the restriction that any type with a linear component must itself be linear. Because of this, checking a protocol on an object imposes aliasing restrictions on any data structure that directly or indirectly points to the object. We propose a new type system that reduces these restrictions with the adoption and focus constructs. Adoption safely allows a programmer to alias objects on which she is checking protocols, and focus allows the reverse. A programmer can alias data structures that point to linear objects and use focus for safe access to those objects. We discuss how we implemented these ideas in the Vault programming language.

References

  1. J. Boyland. Alias burying: Unique variables without destructive reads Software---Practice and Experience, 31(6):533--553, May 2001]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. K. Crary, D. Walker, and G. Morrisett. Typed memory management in a calculus of capabilities]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. R. DeLine and M. Fahndrich. Enforcing high-level protocols in low-level software. Proceedings of the 2001 ACM SIGPLAN Conference on Programming Language Design and Implementation, June 2001]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. D. Gay and A. Aiken. Memory management with explicit regions. Proceedings of the 1998 ACM SIGPLAN Conference on Programming Language Design and Implementation, number 33:5 in SIGPLAN notices, pages 313--323, June 1998]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. F. Henglein, H. Makholm, and H. Niss. A direct approach to control-flow sensitive region-based memory management. ACM Conference on Principles and Practice of Declarative Programming, Sept. 2001]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. S. S. Ishtiaq and P. W. O'Hearn. BI as an assertion language for mutable data structures. Conference Record of the 28th Annual ACM Symposium on Principles of Programming Languages, pages 14--26. ACM Press, Jan. 2001]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. V. Kuncak, P. Lam, and M. C. Rinard. Role analysis. Conference Record of the 29th Annual ACM Symposium on Principles of Programming Languages, Jan. 2002]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. K. R. M. Leino and G. Nelson. Data abstraction and information hiding.Technical Report 160, Compaq SRC, nov 2000]]Google ScholarGoogle Scholar
  9. M. Odersky. Observers for linear types. B. Krieg-Bruckner, editor, ESOP '92: 4th European Symposium on Programming, Rennes, France, Proceedings, pages 390--407, New York, 1992. Springer-Verlag]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Conference Record of the 26th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. ACM Press, Jan. 1999]]Google ScholarGoogle Scholar
  11. M. Sagiv, T. Reps, and R. Wilhelm. Parametric shape analysis via 3-valued logic.In POPL'99 \citepopl99, pages 105--118]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. S. Smetsers, E. Barendsen, M. v. Eekelen, and R. Plasmeijer. Guaranteeing safe destructive updates through a type system with uniqueness information for graphs. Lecture Notes in Computer Science, 776:358--379, 1994]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. F. Smith, D. Walker, and J. G. Morrisett. Alias types. European Symposium on Programming, pages 366--381, 2000]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. R. E. Strom and S. Yemini. Typestate: A programming language concept for enhancing software reliability. SE-12(1):157--171, Jan. 1986]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. M. Tofte, L. Birkedal, M. Elsman, N. Hallenberg, T. H. Olesen, P. Sestoft, and P. Bertelsen. Programming with regions in the ml kit (for version 3). Technical Report 98/25, Department of Computer Science, University of Copenhagen, 1998]]Google ScholarGoogle Scholar
  16. M. Tofte and J.-P. Talpin. Implementation of the typed call-by-value-calculus using a stack of regions. Conference Record of the 21st Annual ACM SSymposium on Principles of Programming Languages, pages 188--201, Jan. 1994]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. P. Wadler. Linear types can change the world! In M. Broy and C. Jones, editors, Programming Concepts and Methods. Apr. 1990. IFIP TC 2 Working Conference]]Google ScholarGoogle Scholar
  18. D. Walker and G. Morrisett. Alias types for recursive data structures. Proceedings of the 4th Workshop on Types in Compilation, Sept. 2000]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. D. Walker and K. Watkins. On linear types and regions. Proceedings of the International Conference on Functional Programming (ICFP '01), Sept. 2001]]Google ScholarGoogle Scholar

Index Terms

  1. Adoption and focus: practical linear types for imperative programming

        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
        • Published in

          cover image ACM Conferences
          PLDI '02: Proceedings of the ACM SIGPLAN 2002 conference on Programming language design and implementation
          June 2002
          338 pages
          ISBN:1581134630
          DOI:10.1145/512529

          Copyright © 2002 ACM

          Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 17 May 2002

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • Article

          Acceptance Rates

          PLDI '02 Paper Acceptance Rate28of169submissions,17%Overall Acceptance Rate406of2,067submissions,20%

          Upcoming Conference

          PLDI '24

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader