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.
- G. M. Bierman, M. Abadi, and M. Torgersen. Understanding Type-Script. In Proc. European Conf. on Object-Oriented Programming (ECOOP), 2014. Google Scholar
Digital Library
- G. Bracha. Pluggable type systems. In OOPSLA Workshop on Revival of Dynamic Languages, 2004.Google Scholar
- G. Bracha. The Dart Programming Language. Addison-Wesley, 2015. Google Scholar
Digital Library
- E. Brandt. Why Dart types are optional and unsound, 2011. https: //www.dartlang.org/articles/why-dart-types/.Google Scholar
- L. Cardelli. Type systems. In The Computer Science and Engineering Handbook, pages 2208–2236. CRC Press, 1997.Google Scholar
- 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 Scholar
Digital Library
- Ecma International. Dart Programming Language Specification, ECMA-408, 4th Edition, December 2015.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Cross Ref
- Facebook. Hack, May 2016. http://hacklang.org/.Google Scholar
- M. Faldborg and T. L. Nielsen. Type systems and programmers: A look at optional typing in Dart. Master’s thesis, Aalborg University, 2015.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- A. M. Maidl, F. Mascarenhas, and R. Ierusalimschy. A formalization of typed Lua. In Proc. 11th ACM Symp. on Dynamic Languages (DLS), 2015. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- V. Menon et al. Strong mode, March 2016. https://github.com/ dart-lang/dev_compiler/blob/master/STRONG_MODE.md.Google Scholar
- Microsoft. TypeScript language specification, February 2015. http://www.typescriptlang.org/Content/TypeScript% 20Language%20Specification.pdf.Google Scholar
- 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 Scholar
Digital Library
- C. Parnin, C. Bird, and E. R. Murphy-Hill. Adoption and use of Java generics. Empirical Software Engineering, 18(6):1047–1089, 2013. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- J. G. Siek and W. Taha. Gradual typing for functional languages. In Scheme and Functional Programming Workshop, 2006.Google Scholar
- 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 Scholar
- C. Souza and E. Figueiredo. How do programmers use optional typing?: an empirical study. In Proc. 13th Int. Conf. on Modularity (MODULARITY), 2014. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- L. Tratt. Dynamically typed languages. Advances in Computers, 77: 149–184, 2009.Google Scholar
Cross Ref
- 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 Scholar
Digital Library
Index Terms
Type unsoundness in practice: an empirical study of Dart
Recommendations
Type unsoundness in practice: an empirical study of Dart
DLS 2016: Proceedings of the 12th Symposium on Dynamic LanguagesThe 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 ...
The gradualizer: a methodology and algorithm for generating gradual type systems
POPL '16: Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming LanguagesMany languages are beginning to integrate dynamic and static typing. Siek and Taha offered gradual typing as an approach to this integration that provides a coherent and full-span migration between the two disciplines. However, the literature lacks a ...
The gradualizer: a methodology and algorithm for generating gradual type systems
POPL '16Many languages are beginning to integrate dynamic and static typing. Siek and Taha offered gradual typing as an approach to this integration that provides a coherent and full-span migration between the two disciplines. However, the literature lacks a ...







Comments