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.
- M. Abadi and L. Cardelli. A Theory of Objects. Springer-Verlag, 1996. Google Scholar
Cross Ref
- G. Bierman, M. Abadi, and M. Torgersen. Understanding TypeScript. In ECOOP, pages 257–281, 2014.Google Scholar
Digital Library
- G. Bracha. Pluggable type systems. In OOPSLA Workshop on Revival of Dynamic Languages, 2004.Google Scholar
- G. Bracha and D. Griswold. Strongtalk: Typechecking Smalltalk in a production environment. In OOPSLA, pages 215–230, 1993. Google Scholar
Digital Library
- R. Cartwright and M. Fagan. Soft typing. In PLDI, pages 278–292, 1991. Google Scholar
Digital Library
- C. Dimoulas, R. B. Findler, C. Flanagan, and M. Felleisen. Correct blame for contracts: no more scapegoating. In POPL, pages 215–226, 2011. Google Scholar
Digital Library
- Ecma International. C# Language Specification, ECMA-334, June 2006.Google Scholar
- Ecma International. ECMAScript Language Specification, ECMA-262, June 2011.Google Scholar
- Ecma International. Dart Programming Language Specification, ECMA-408, December 2014.Google Scholar
- 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 Scholar
- C. Flanagan. Hybrid type checking. In POPL, pages 245–256, 2006. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- T. Lindahl and K. F. Sagonas. Practical type inference based on success typings. In PPDP, pages 167–178, 2006. Google Scholar
Digital Library
- 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 Scholar
- Personal communication with Gilad Bracha and the Dart team at Google, 2015.Google Scholar
- J. G. Politz, H. Q. de la Vallee, and S. Krishnamurthi. Progressive types. In Onward!, pages 55–66, 2012. Google Scholar
Digital Library
- J. Siek and W. Taha. Gradual typing for objects. In ECOOP, pages 151–175, 2007. Google Scholar
Digital Library
- S. Tobin-Hochstadt and M. Felleisen. The design and implementation of Typed Scheme. In POPL, pages 395–406, 2008. Google Scholar
Digital Library
- K. Walrath and S. Ladd. dart: The Standalone VM. Google, June 2014.Google Scholar
- https://www.dartlang. org/docs/dart-up-and-running/contents/ ch04-tools-dart-vm.html.Google Scholar
- J. Winther and M. I. Schwartzbach. Related types. In ECOOP, pages 434–458, 2011. Google Scholar
Digital Library
- A. K. Wright and R. Cartwright. A practical soft type system for Scheme. ACM Trans. Program. Lang. Syst., 19(1):87–152, 1997. Google Scholar
Digital Library
- 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 Scholar
Digital Library
Index Terms
Message safety in Dart
Recommendations
Type safety analysis for Dart
DLS '16Optional typing is traditionally viewed as a compromise between static and dynamic type checking, where code without type annotations is not checked until runtime. We demonstrate that optional type annotations in Dart programs can be integrated into a ...
Message safety in Dart
DLS 2015: Proceedings of the 11th Symposium on Dynamic LanguagesUnlike 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 ...
Type safety analysis for Dart
DLS 2016: Proceedings of the 12th Symposium on Dynamic LanguagesOptional typing is traditionally viewed as a compromise between static and dynamic type checking, where code without type annotations is not checked until runtime. We demonstrate that optional type annotations in Dart programs can be integrated into a ...






Comments