Many researchers have explored ways to bring static typing to dynamic languages. However, to date, such systems are not precise enough when types depend on values, which often arises when using certain Ruby libraries. For example, the type safety of a database query in Ruby on Rails depends on the table and column names used in the query. To address this issue, we introduce CompRDL, a type system for Ruby that allows library method type signatures to include type-level computations (or comp types for short). Combined with singleton types for table and column names, comp types let us give database query methods type signatures that compute a table's schema to yield very precise type information. Comp types for hash, array, and string libraries can also increase precision and thereby reduce the need for type casts. We formalize CompRDL and prove its type system sound. Rather than type check the bodies of library methods with comp types---those methods may include native code or be complex---CompRDL inserts run-time checks to ensure library methods abide by their computed types. We evaluated CompRDL by writing annotations with type-level computations for several Ruby core libraries and database query APIs. We then used those annotations to type check two popular Ruby libraries and four Ruby on Rails web apps. We found the annotations were relatively compact and could successfully type check 132 methods across our subject programs. Moreover, the use of type-level computations allowed us to check more expressive properties, with fewer manually inserted casts, than was possible without type-level computations. In the process, we found two type errors and a documentation error that were confirmed by the developers. Thus, we believe CompRDL is an important step forward in bringing precise static type checking to dynamic languages.


翻译:许多研究人员探索了将静态打字引入动态语言的方法。然而,到目前为止,当类型取决于值时,这种系统不够精确,因为类型取决于值,而值通常在使用某些Ruby 图书馆时往往会出现。例如,铁路Ruby 数据库查询的类型安全取决于查询中使用的表格和列名名称。为了解决这个问题,我们为Ruby 引入了CompRDL 类型系统,允许图书馆方法类型签名包括类型级计算(或简称的计算类型)。与表格和列名的单吨类型相结合,复合类型让我们提供数据库查询方法类型签名,用以计算表格的系统,以生成非常精确的类型信息。仓、阵列和字符串库的计算文档类型也能够提高精确性格,从而减少对类型文件的需要。我们正式化了CompRBL 并证明了其类型系统健全。我们不用键盘来检查图书馆机构的方法,包括本地代码或复杂(简称简称为缩略略) 插入运行时间检查,以确保其计算型号得到遵守。我们后来通过不使用格式的 RComdrevL,我们后来通过不使用类型进行类型进行格式的版本的计算,我们后来用类型来进行格式计算,我们用格式的 RComdrevdL 和格式的版本的版本来进行计算。我们用两个类型来进行格式计算,然后以打印的版本的计算。我们用类型来进行格式计算,我们用来的计算,我们用格式的版本的 Restrencerencerencerenceal 。我们用两个的版本的版本的版本的版本的 Restrence 。我们用的是,这些版本的版本的版本的版本的版本来为我们的版本的版本的版本的版本的版本的版本的版本的计算,我们用的是,我们用的是,我们用的是,我们用来的版本的版本的版本的 Restdrodrodrodrodrodrodrodrodrodro 。我们用的版本的计算,我们用的是,我们用的是,我们用的是,我们用的是,我们用的是,我们用的是,我们用两个realbalbalbrobalbal 。

0
下载
关闭预览

相关内容

Ruby 是一种面向对象、命令式、函数式、动态的通用编程语言。
一份简明有趣的Python学习教程,42页pdf
专知会员服务
77+阅读 · 2020年6月22日
商业数据分析,39页ppt
专知会员服务
162+阅读 · 2020年6月2日
Python地理数据处理,362页pdf,Geoprocessing with Python
专知会员服务
114+阅读 · 2020年5月24日
【干货书】真实机器学习,264页pdf,Real-World Machine Learning
《DeepGCNs: Making GCNs Go as Deep as CNNs》
专知会员服务
31+阅读 · 2019年10月17日
强化学习最新教程,17页pdf
专知会员服务
177+阅读 · 2019年10月11日
机器学习入门的经验与建议
专知会员服务
94+阅读 · 2019年10月10日
【TED】生命中的每一年的智慧
英语演讲视频每日一推
10+阅读 · 2019年1月29日
RL 真经
CreateAMind
5+阅读 · 2018年12月28日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
17+阅读 · 2018年12月24日
Python 杠上 Java、C/C++,赢面有几成?
CSDN
6+阅读 · 2018年4月12日
Python机器学习教程资料/代码
机器学习研究会
8+阅读 · 2018年2月22日
Adversarial Variational Bayes: Unifying VAE and GAN 代码
CreateAMind
7+阅读 · 2017年10月4日
【推荐】用Tensorflow理解LSTM
机器学习研究会
36+阅读 · 2017年9月11日
【推荐】RNN/LSTM时序预测
机器学习研究会
25+阅读 · 2017年9月8日
【推荐】SVM实例教程
机器学习研究会
17+阅读 · 2017年8月26日
A survey on deep hashing for image retrieval
Arxiv
15+阅读 · 2020年6月10日
Arxiv
12+阅读 · 2019年3月14日
Rapid Customization for Event Extraction
Arxiv
7+阅读 · 2018年9月20日
Feature Selection Library (MATLAB Toolbox)
Arxiv
7+阅读 · 2018年8月6日
Arxiv
3+阅读 · 2018年4月5日
Arxiv
5+阅读 · 2018年1月30日
Arxiv
5+阅读 · 2017年11月30日
VIP会员
相关VIP内容
一份简明有趣的Python学习教程,42页pdf
专知会员服务
77+阅读 · 2020年6月22日
商业数据分析,39页ppt
专知会员服务
162+阅读 · 2020年6月2日
Python地理数据处理,362页pdf,Geoprocessing with Python
专知会员服务
114+阅读 · 2020年5月24日
【干货书】真实机器学习,264页pdf,Real-World Machine Learning
《DeepGCNs: Making GCNs Go as Deep as CNNs》
专知会员服务
31+阅读 · 2019年10月17日
强化学习最新教程,17页pdf
专知会员服务
177+阅读 · 2019年10月11日
机器学习入门的经验与建议
专知会员服务
94+阅读 · 2019年10月10日
相关资讯
【TED】生命中的每一年的智慧
英语演讲视频每日一推
10+阅读 · 2019年1月29日
RL 真经
CreateAMind
5+阅读 · 2018年12月28日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
17+阅读 · 2018年12月24日
Python 杠上 Java、C/C++,赢面有几成?
CSDN
6+阅读 · 2018年4月12日
Python机器学习教程资料/代码
机器学习研究会
8+阅读 · 2018年2月22日
Adversarial Variational Bayes: Unifying VAE and GAN 代码
CreateAMind
7+阅读 · 2017年10月4日
【推荐】用Tensorflow理解LSTM
机器学习研究会
36+阅读 · 2017年9月11日
【推荐】RNN/LSTM时序预测
机器学习研究会
25+阅读 · 2017年9月8日
【推荐】SVM实例教程
机器学习研究会
17+阅读 · 2017年8月26日
相关论文
Top
微信扫码咨询专知VIP会员