Towards a Type System for Analyzing JavaScript Programs

Towards a Type System for Analyzing JavaScript Programs
复制标题

DOI:
10.1007/978-3-540-31987-0_28
复制
发表时间:
2005-04
期刊:
--
影响因子:
--
通讯作者:
Peter Thiemann
Peter Thiemann
中科院分区:
其他
文献类型:
--
作者:
Peter Thiemann

文献摘要

被引文献

相似文献

JavaScript是一种流行的客户端Web脚本语言。由于两个原因,它在程序员中的声誉令人怀疑。首先,许多JavaScript程序都是针对快速发展的API编写的,这些API的实现有时是矛盾和特殊的。其次,这种语言只有弱类型,实际上没有开发工具。它通过定义一个类型系统来跟踪对象的可能特征并标记可疑的类型转换来做到这一点。由于JavaScript是一种无类的、基于对象的语言,具有一流的函数,因此类型系统必须包括单例类型、子类型和一流的记录标签。类型系统覆盖了语言的一个代表性子集,并且有一个关于操作语义的类型可靠性证明。
JavaScript is a popular language for client-side web scripting. It has a dubious reputation among programmers for two reasons. First, many JavaScript programs are written against a rapidly evolving API whose implementations are sometimes contradictory and idiosyncratic. Second, the language is only weakly typed and comes virtually without development tools.The present work is a first attempt to address the second point. It does so by defining a type system that tracks the possible traits of an object and flags suspicious type conversions. Because JavaScript is a classless, object-based language with first-class functions, the type system must include singleton types, subtyping, and first class record labels. The type system covers a representative subset of the language and there is a type soundness proof with respect to an operational semantics.