What we eval in the shadows: a large-scale study of eval in R programs

What we eval in the shadows: a large-scale study of eval in R programs
复制标题

DOI:
10.1145/3485502
复制
发表时间:
2021-10
影响因子:
--
通讯作者:
Aviral Goel;P. Donat-Bouillud;Filip Krikava;C. Kirsch;J. Vitek
Aviral Goel;P. Donat-Bouillud;Filip Krikava;C. Kirsch;J. Vitek
中科院分区:
--
文献类型:
--
作者:
Aviral Goel;P. Donat-Bouillud;Filip Krikava;C. Kirsch;J. Vitek

文献摘要

相似文献

大多数动态语言允许用户使用各种函数(通常称为eval)将文本转换为代码,这些函数具有语言相关的语义。这些反射函数的广泛使用阻碍了静态分析,并阻止编译器执行优化。本文旨在更好地理解程序员为什么要使用eval。了解为什么在实践中使用eval是找到减轻其负面影响的方法的关键。我们有理由相信反射功能的使用是特定于语言和应用领域的;我们专注于用R编写的数据科学代码,并将我们的结果与以前分析JavaScript中Web编程的工作进行比较。我们分析了从15,401个R包中提取的240,327个脚本中的49,296,059个eval调用。我们发现eval确实被广泛使用; R的eval比以前报道的JavaScript更普遍,也更危险。
Most dynamic languages allow users to turn text into code using various functions, often named eval, with language-dependent semantics. The widespread use of these reflective functions hinders static analysis and prevents compilers from performing optimizations. This paper aims to provide a better sense of why programmers use eval. Understanding why eval is used in practice is key to finding ways to mitigate its negative impact. We have reasons to believe that reflective feature usage is language and application domain-specific; we focus on data science code written in R and compare our results to previous work that analyzed web programming in JavaScript. We analyze 49,296,059 calls to eval from 240,327 scripts extracted from 15,401 R packages. We find that eval is indeed in widespread use; R’s eval is more pervasive and arguably dangerous than what was previously reported for JavaScript.