Trace Typing:一种评价改型系统的方法(扩展版)
Trace Typing: An Approach for Evaluating Retrofitted Type Systems (Extended Version)
摘要:
近年来,为了提高类型安全性、程序员的生产力或性能,对将类型系统改造为动态类型程序设计语言的兴趣越来越大。在这种情况下,类型系统开发人员必须在不允许某些编码模式以保持类型系统简单,或以额外的复杂性和工作为代价包括它们之间取得微妙的平衡。到目前为止,设计改型类型系统的过程在很大程度上是临时的,因为在大量现有代码上评估类型系统的多种变体是一项重要的任务。我们提出了跟踪类型:一个框架,自动和定量评估大型代码库的改型类型系统的变化。跟踪类型化方法涉及收集程序执行的跟踪,推断跟踪中出现的变量和表达式的实例的类型,以及根据反映源级别类型系统设计空间中的特定选择(组合)的合并策略合并类型。我们通过几个实验评估了痕迹分型。我们比较了几种改进到JavaScript上的类型系统的变体,测量了在每种情况下超过5万行JavaScript代码中存在类型错误的程序位置的数量。我们还使用跟踪类型来验证和指导一个新的改进类型系统的设计,该系统为JavaScript对象强制执行固定的对象布局。最后,我们利用跟踪类型计算的类型来自动识别标记测试-细化类型的动态检查-并检查所识别的各种测试。
英文摘要:
Recent years have seen growing interest in the retrofitting of type systems onto dynamically-typed programming languages, in order to improve type safety, programmer productivity, or performance. In such cases, type system developers must strike a delicate balance between disallowing certain coding patterns to keep the type system simple, or including them at the expense of additional complexity and effort. Thus far, the process for designing retrofitted type systems has been largely ad hoc, because evaluating multiple variations of a type system on large bodies of existing code is a significant undertaking. We present trace typing: a framework for automatically and quantitatively evaluating variations of a retrofitted type system on large code bases. The trace typing approach involves gathering traces of program executions, inferring types for instances of variables and expressions occurring in a trace, and merging types according to merge strategies that reflect specific (combinations of) choices in the source-level type system design space. We evaluated trace typing through several experiments. We compared several variations of type systems retrofitted onto JavaScript, measuring the number of program locations with type errors in each case on a suite of over fifty thousand lines of JavaScript code. We also used trace typing to validate and guide the design of a new retrofitted type system that enforces fixed object layout for JavaScript objects. Finally, we leveraged the types computed by trace typing to automatically identify tag tests --- dynamic checks that refine a type --- and examined the variety of tests identified.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。