skip to main content
research-article

Message safety in Dart

Published:21 October 2015Publication History
Skip Abstract Section

Abstract

Unlike traditional static type checking, the type system in the Dart programming language is unsound by design, even for fully annotated programs. The rationale has been that this allows compile-time detection of likely errors and enables code completion in integrated development environments, without being restrictive on programmers. Despite unsoundness, judicious use of type annotations can ensure useful properties of the runtime behavior of Dart programs. We present a formal model of a core of Dart with a focus on its type system, which allows us to elucidate the causes of unsoundness. Our main contribution is a characterization of message-safe programs and a theorem stating that such programs will never encounter 'message not understood' errors at runtime. Message safety is less restrictive than traditional type soundness, and we argue that it forms a natural intermediate point between dynamically typed and statically typed Dart programs.

References

  1. M. Abadi and L. Cardelli. A Theory of Objects. Springer-Verlag, 1996. Google ScholarGoogle ScholarCross RefCross Ref
  2. G. Bierman, M. Abadi, and M. Torgersen. Understanding TypeScript. In ECOOP, pages 257–281, 2014.Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. G. Bracha. Pluggable type systems. In OOPSLA Workshop on Revival of Dynamic Languages, 2004.Google ScholarGoogle Scholar
  4. G. Bracha and D. Griswold. Strongtalk: Typechecking Smalltalk in a production environment. In OOPSLA, pages 215–230, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. R. Cartwright and M. Fagan. Soft typing. In PLDI, pages 278–292, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. C. Dimoulas, R. B. Findler, C. Flanagan, and M. Felleisen. Correct blame for contracts: no more scapegoating. In POPL, pages 215–226, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Ecma International. C# Language Specification, ECMA-334, June 2006.Google ScholarGoogle Scholar
  8. Ecma International. ECMAScript Language Specification, ECMA-262, June 2011.Google ScholarGoogle Scholar
  9. Ecma International. Dart Programming Language Specification, ECMA-408, December 2014.Google ScholarGoogle Scholar
  10. E. Ernst, A. Møller, M. Schwarz, and F. Strocco. Message safety in Dart. Technical report, Department of Computer Science, Aarhus University, 2015. http://www.brics.dk/ fletch/.Google ScholarGoogle Scholar
  11. C. Flanagan. Hybrid type checking. In POPL, pages 245–256, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. J. Gosling, B. Joy, G. L. Steele Jr., G. Bracha, and A. Buckley. The Java Language Specification, Java SE 7 Edition. Addison-Wesley Professional, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. 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, May 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. T. Lindahl and K. F. Sagonas. Practical type inference based on success typings. In PPDP, pages 167–178, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. J. Mackay, H. Mehnert, A. Potanin, L. Groves, and N. Cameron. Encoding Featherweight Java with assignment and immutability using the Coq proof assistant. Technical report, Victoria University of Wellington, 2012.Google ScholarGoogle Scholar
  16. Personal communication with Gilad Bracha and the Dart team at Google, 2015.Google ScholarGoogle Scholar
  17. J. G. Politz, H. Q. de la Vallee, and S. Krishnamurthi. Progressive types. In Onward!, pages 55–66, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. J. Siek and W. Taha. Gradual typing for objects. In ECOOP, pages 151–175, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. S. Tobin-Hochstadt and M. Felleisen. The design and implementation of Typed Scheme. In POPL, pages 395–406, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. K. Walrath and S. Ladd. dart: The Standalone VM. Google, June 2014.Google ScholarGoogle Scholar
  21. https://www.dartlang. org/docs/dart-up-and-running/contents/ ch04-tools-dart-vm.html.Google ScholarGoogle Scholar
  22. J. Winther and M. I. Schwartzbach. Related types. In ECOOP, pages 434–458, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. A. K. Wright and R. Cartwright. A practical soft type system for Scheme. ACM Trans. Program. Lang. Syst., 19(1):87–152, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. T. Wrigstad, F. Z. Nardelli, S. Lebresne, J. Östlund, and J. Vitek. Integrating typed and untyped code in a scripting language. In POPL, pages 377–388, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Message safety in Dart

      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

      • Published in

        cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 51, Issue 2
        DLS '15
        Feburary 2016
        176 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/2936313
        • Editor:
        • Andy Gill
        Issue’s Table of Contents
        • cover image ACM Conferences
          DLS 2015: Proceedings of the 11th Symposium on Dynamic Languages
          October 2015
          176 pages
          ISBN:9781450336901
          DOI:10.1145/2816707

        Copyright © 2015 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 21 October 2015

        Check for updates

        Qualifiers

        • research-article

      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!