Designing types for R, empirically
Authors:
Open Access
- 13 November 2020
- journal article
- research article
- Published by Association for Computing Machinery (ACM) in Proceedings of the ACM on Programming Languages
- Vol. 4 (OOPSLA) , 1-25
Abstract
The R programming language is widely used in a variety of domains. It was designed to favor an interactive style of programming with minimal syntactic and conceptual overhead. This design is well suited to data analysis, but a bad fit for tools such as compilers or program analyzers. In particular, R has no type annotations, and all operations are dynamically checked at run-time. The starting point for our work are the two questions: what expressive power is needed to accurately type R code? and which type system is the R community willing to adopt? Both questions are difficult to answer without actually experimenting with a type system. The goal of this paper is to provide data that can feed into that design process. To this end, we perform a large corpus analysis to gain insights in the degree of polymorphism exhibited by idiomatic R code and explore potential benefits that the R community could accrue from a simple type system. As a starting point, we infer type signatures for 25,215 functions from 412 packages among the most widely used open source R libraries. We then conduct an evaluation on 8,694 clients of these packages, as well as on end-user code from the Kaggle data science competition website.Keywords
Funding Information
- Natural Sciences and Engineering Research Council of Canada
- National Science Foundation (1759736, 1544542, 1925644, 1910850)
- ERC European Union's Horizon 2020 Research Programme (695412)
- Office of Naval Research (503353)
- Czech Ministry of Education, Youth, and Sports fomr the Czech Operational Programme Research, Development, and Education (CZ.02.1.01/0.0/0.0/15_003/0000421)
This publication has 11 references indexed in Scilit:
- Typilus: neural type hints2020
- On the design, implementation, and use of laziness in RProceedings of the ACM on Programming Languages, 2019
- Julia: dynamism and performance reconciled by designProceedings of the ACM on Programming Languages, 2018
- Typed Lua2014
- Evaluating the Design of the R Language2012
- Dynamic inference of static types for ruby2011
- Integrating typed and untyped code in a scripting language2010
- Adding Dynamic Types to C $^\sharp$2010
- Profile-guided static typing for dynamic scripting languages2009
- The design and implementation of typed scheme2008