skip to main content
article

Type unsoundness in practice: an empirical study of Dart

Published:01 November 2016Publication History
Skip Abstract Section

Abstract

The type system in the Dart programming language is deliberately designed to be unsound: for a number of reasons, it may happen that a program encounters type errors at runtime although the static type checker reports no warnings. According to the language designers, this ensures a pragmatic balance between the ability to catch bugs statically and allowing a flexible programming style without burdening the programmer with a lot of spurious type warnings. In this work, we attempt to experimentally validate these design choices. Through an empirical evaluation based on open source programs written in Dart totaling 2.4 M LOC, we explore how alternative, more sound choices affect the type warnings being produced. Our results show that some, but not all, sources of unsoundness can be justified. In particular, we find that unsoundness caused by bivariant function subtyping and method overriding does not seem to help programmers. Such information may be useful when designing future versions of the language or entirely new languages.

References

  1. G. M. Bierman, M. Abadi, and M. Torgersen. Understanding Type-Script. In Proc. European Conf. on Object-Oriented Programming (ECOOP), 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. G. Bracha. Pluggable type systems. In OOPSLA Workshop on Revival of Dynamic Languages, 2004.Google ScholarGoogle Scholar
  3. G. Bracha. The Dart Programming Language. Addison-Wesley, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. E. Brandt. Why Dart types are optional and unsound, 2011. https: //www.dartlang.org/articles/why-dart-types/.Google ScholarGoogle Scholar
  5. L. Cardelli. Type systems. In The Computer Science and Engineering Handbook, pages 2208–2236. CRC Press, 1997.Google ScholarGoogle Scholar
  6. M. Christakis, P. Müller, and V. Wüstholz. An experimental evaluation of deliberate unsoundness in a static program analyzer. In Proc. 16th Int. Conf. on Verification, Model Checking, and Abstract Interpretation (VMCAI), 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Ecma International. Dart Programming Language Specification, ECMA-408, 4th Edition, December 2015.Google ScholarGoogle Scholar
  8. S. Endrikat, S. Hanenberg, R. Robbes, and A. Stefik. How do API documentation and static typing affect API usability? In Proc. 36th Int. Conf. on Software Engineering (ICSE), 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. E. Ernst, A. Møller, M. Schwarz, and F. Strocco. Message safety in Dart. Science of Computer Programming, 2016. In press. Earlier version in Proc. 11th Symp. on Dynamic Languages (DLS), 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. L. M. Eshkevari, F. D. Santos, J. R. Cordy, and G. Antoniol. Are PHP applications ready for Hack? In Proc. 22nd IEEE Int. Conf. on Software Analysis, Evolution, and Reengineering (SANER), 2015.Google ScholarGoogle ScholarCross RefCross Ref
  11. Facebook. Hack, May 2016. http://hacklang.org/.Google ScholarGoogle Scholar
  12. M. Faldborg and T. L. Nielsen. Type systems and programmers: A look at optional typing in Dart. Master’s thesis, Aalborg University, 2015.Google ScholarGoogle Scholar
  13. S. Hanenberg. An experiment about static and dynamic type systems: doubts about the positive impact of static type systems on development time. In Proc. 25th Annual ACM SIGPLAN Conf. on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. S. Hanenberg, S. Kleinschmager, R. Robbes, É. Tanter, and A. Stefik. An empirical study on the impact of static typing on software maintainability. Empirical Software Engineering, 19(5):1335–1382, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. M. Hoppe and S. Hanenberg. Do developers benefit from generic types?: an empirical comparison of generic and raw types in java. In Proc. ACM SIGPLAN Int. Conf. on Object Oriented Programming Systems Languages & Applications (OOPSLA), 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. B. Livshits, M. Sridharan, Y. Smaragdakis, O. Lhoták, J. N. Amaral, B.-Y. E. Chang, S. Z. Guyer, U. P. Khedker, A. Møller, and D. Vardoulakis. In defense of soundiness: A manifesto. Commun. ACM, 58 (2):44–46, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. A. M. Maidl, F. Mascarenhas, and R. Ierusalimschy. A formalization of typed Lua. In Proc. 11th ACM Symp. on Dynamic Languages (DLS), 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. S. Markstrum. Staking claims: A history of programming language design claims and evidence. In Workshop on Evaluation and Usability of Programming Languages and Tools (PLATEAU), 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. E. Meijer and P. Drayton. Static typing where possible, dynamic typing when needed: The end of the cold war between programming languages. In OOPSLA Workshop on Revival of Dynamic Languages, 2004.Google ScholarGoogle Scholar
  20. V. Menon et al. Strong mode, March 2016. https://github.com/ dart-lang/dev_compiler/blob/master/STRONG_MODE.md.Google ScholarGoogle Scholar
  21. Microsoft. TypeScript language specification, February 2015. http://www.typescriptlang.org/Content/TypeScript% 20Language%20Specification.pdf.Google ScholarGoogle Scholar
  22. E. R. Murphy-Hill and D. Grossman. How programming languages will co-evolve with software engineering: a bright decade ahead. In Proc. Future of Software Engineering (FOSE), 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. C. Parnin, C. Bird, and E. R. Murphy-Hill. Adoption and use of Java generics. Empirical Software Engineering, 18(6):1047–1089, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. L. Prechelt and W. F. Tichy. A controlled experiment to assess the benefits of procedure argument type checking. IEEE Trans. Software Eng., 24(4):302–312, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. A. Rastogi, N. Swamy, C. Fournet, G. M. Bierman, and P. Vekris. Safe & efficient gradual typing for TypeScript. In Proc. 42nd ACM SIGPLAN-SIGACT Symp. on Principles of Programming Languages (POPL), 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. A. Rastogi, N. Swamy, C. Fournet, G. M. Bierman, and P. Vekris. Safe & efficient gradual typing for TypeScript. In Proc. 42nd ACM SIGPLAN-SIGACT Symp. on Principles of Programming Languages (POPL), 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. J. G. Siek and W. Taha. Gradual typing for functional languages. In Scheme and Functional Programming Workshop, 2006.Google ScholarGoogle Scholar
  28. J. G. Siek, M. M. Vitousek, M. Cimini, and J. T. Boyland. Refined criteria for gradual typing. In Proc. 1st Summit on Advances in Programming Languages (SNAPL), 2015.Google ScholarGoogle Scholar
  29. C. Souza and E. Figueiredo. How do programmers use optional typing?: an empirical study. In Proc. 13th Int. Conf. on Modularity (MODULARITY), 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. A. Stefik and S. Hanenberg. The programming language wars: Questions and responsibilities for the programming language community. In Proc. ACM Int. Symp. on New Ideas, New Paradigms, and Reflections on Programming & Software (Onward!), 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. A. Takikawa, D. Feltey, B. Greenman, M. S. New, J. Vitek, and M. Felleisen. Is sound gradual typing dead? In Proc. 43rd Annual ACM SIGPLAN-SIGACT Symp. on Principles of Programming Languages (POPL), 2016. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. S. Tobin-Hochstadt and M. Felleisen. The design and implementation of Typed Scheme. In Proc. 35th ACM SIGPLAN-SIGACT Symp. on Principles of Programming Languages (POPL), 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. L. Tratt. Dynamically typed languages. Advances in Computers, 77: 149–184, 2009.Google ScholarGoogle ScholarCross RefCross Ref
  34. M. M. Vitousek, A. M. Kent, J. G. Siek, and J. Baker. Design and evaluation of gradual typing for Python. In Proc. 10th ACM Symp. on Dynamic Languages (DLS), 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Type unsoundness in practice: an empirical study of 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 52, Issue 2
      DLS '16
      February 2017
      131 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/3093334
      Issue’s Table of Contents
      • cover image ACM Conferences
        DLS 2016: Proceedings of the 12th Symposium on Dynamic Languages
        November 2016
        131 pages
        ISBN:9781450344456
        DOI:10.1145/2989225

      Copyright © 2016 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 1 November 2016

      Check for updates

      Qualifiers

      • 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!