skip to main content
10.1145/1924520.1924527acmotherconferencesArticle/Chapter ViewAbstractPublication PagesecoopConference Proceedingsconference-collections
research-article

Aliasing control with view-based typestate

Published:22 June 2010Publication History

ABSTRACT

Tracking the state of an object (in the sense of how a File can be in an Open or Closed state) is difficult not just because of the problem of managing state transitions but also due to the complexity introduced by aliasing. Unchecked duplication of object references makes local reasoning impossible by allowing situations where transitions can be triggered unexpectedly (for instance, passing aliased parameters to a method that expects unaliased parameters, or calling a method that has a side effect through an alias deeply nested in a data structure).

We propose a generalization of access permissions that goes beyond a fixed set of permissions to an object. In this paper we present a new aliasing control mechanism that uses a small set of permissions as building block for the creation of views that capture a projection of an object with specific access constraints to its fields and/or methods. This makes permission tracking more fine grained while also making the designer's intent more explicit.

We present a few meaningful examples of how these views handle situations such as: separating different sections of an object for safe initialization; and access with either an unbounded number of readers or a single writer (multiple readers or unique writer). Finally, we show a type system for checking correctness of state use in the presence of this kind of controlled aliasing.

References

  1. J. Aldrich, J. Sunshine, D. Saini, and Z. Sparks. Typestate-oriented programming. In Proc. Onward!, pages 1015--1022, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. K. Bierhoff and J. Aldrich. Modular typestate checking of aliased objects. In Proc. Object-Oriented Programming Systems, Languages, and Applications, pages 301--320, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. J. Boyland. Checking interference with fractional permissions. In Proc. Static Analysis Symposium, pages 55--72, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. L. Caires. Spatial-behavioral types for concurrency and resource control in distributed systems. Theor. Comput. Sci., 402(2--3):120--141, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. C. Calcagno, P. W. O'Hearn, and H. Yang. Local action and abstract separation logic. In Proc. Logic in Computer Science, pages 366--378, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. F. Damiani, E. Giachino, P. Giannini, and S. Drossopoulou. A type safe state abstraction for coordination in java-like languages. Acta Inf., 45(7--8):479--536, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. R. DeLine and M. Fähndrich. Typestates for objects. In European Conference on Object-Oriented Programming, pages 465--490. Springer, 2004.Google ScholarGoogle ScholarCross RefCross Ref
  8. S. J. Gay, V. T. Vasconcelos, A. Ravara, N. Gesbert, and A. Z. Caldeira. Modular session types for distributed object-oriented programming. In Proc. Principles of Programming Languages, pages 299--312, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. A. Igarashi, B. C. Pierce, and P. Wadler. Featherweight Java: a minimal core calculus for Java and GJ. ACM Trans. Program. Lang. Syst., 23(3):396--450, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. K. R. M. Leino. Data groups: specifying the modification of extended state. SIGPLAN Not., 33(10):144--153, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. X. Qi and A. C. Myers. Masked types for sound object initialization. In Proc. Principles of Programming Languages, pages 53--65, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. J. C. Reynolds. Separation logic: A logic for shared mutable data structures. In Proc. Logic in Computer Science, pages 55--74, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. A. Sabry and M. Felleisen. Reasoning about programs in continuation-passing style. In Proc. LISP and Functional Programming, pages 288--298, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. R. E. Strom and S. Yemini. Typestate: A programming language concept for enhancing software reliability. IEEE Trans. Software Eng., 12(1):157--171, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. P. Wadler. Linear types can change the world! In Programming Concepts and Methods. North, 1990.Google ScholarGoogle Scholar

Index Terms

  1. Aliasing control with view-based typestate

          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 Other conferences
            FTFJP '10: Proceedings of the 12th Workshop on Formal Techniques for Java-Like Programs
            June 2010
            66 pages
            ISBN:9781450305402
            DOI:10.1145/1924520

            Copyright © 2010 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: 22 June 2010

            Permissions

            Request permissions about this article.

            Request Permissions

            Check for updates

            Qualifiers

            • research-article

            Acceptance Rates

            Overall Acceptance Rate51of75submissions,68%

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader