TeJaS: retrofitting type systems for JavaScript

Benjamin S. Lerner, J. Politz, Arjun Guha, S. Krishnamurthi
{"title":"TeJaS: retrofitting type systems for JavaScript","authors":"Benjamin S. Lerner, J. Politz, Arjun Guha, S. Krishnamurthi","doi":"10.1145/2508168.2508170","DOIUrl":null,"url":null,"abstract":"JavaScript programs vary widely in functionality, complexity, and use, and analyses of these programs must accommodate such variations. Type-based analyses are typically the simplest such analyses, but due to the language's subtle idioms and many application-specific needs---such as ensuring general-purpose type correctness, security properties, or proper library usage---we have found that a single type system does not suffice for all purposes. However, these varied uses still share many reusable common elements.\n In this paper we present TeJaS, a framework for building type systems for JavaScript. TeJaS has been engineered modularly to encourage experimentation. Its initial type environment is reified, to admit easy modeling of the various execution contexts of JavaScript programs, and its type language and typing rules are extensible, to enable variations of the type system to be constructed easily.\n The paper presents the base TeJaS type system, which performs traditional type-checking for JavaScript. Because JavaScript demands complex types, we explain several design decisions to improve user ergonomics. We then describe TeJaS's modular structure, and illustrate it by reconstructing the essence of a very different type system for JavaScript. Systems built from TeJaS have been applied to several real-world, third-party JavaScript programs.","PeriodicalId":344101,"journal":{"name":"Dynamic Languages Symposium","volume":"6 5 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2013-10-28","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"51","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Dynamic Languages Symposium","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/2508168.2508170","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 51

Abstract

JavaScript programs vary widely in functionality, complexity, and use, and analyses of these programs must accommodate such variations. Type-based analyses are typically the simplest such analyses, but due to the language's subtle idioms and many application-specific needs---such as ensuring general-purpose type correctness, security properties, or proper library usage---we have found that a single type system does not suffice for all purposes. However, these varied uses still share many reusable common elements. In this paper we present TeJaS, a framework for building type systems for JavaScript. TeJaS has been engineered modularly to encourage experimentation. Its initial type environment is reified, to admit easy modeling of the various execution contexts of JavaScript programs, and its type language and typing rules are extensible, to enable variations of the type system to be constructed easily. The paper presents the base TeJaS type system, which performs traditional type-checking for JavaScript. Because JavaScript demands complex types, we explain several design decisions to improve user ergonomics. We then describe TeJaS's modular structure, and illustrate it by reconstructing the essence of a very different type system for JavaScript. Systems built from TeJaS have been applied to several real-world, third-party JavaScript programs.
TeJaS:为JavaScript改进类型系统
JavaScript程序在功能、复杂性和用途方面变化很大,对这些程序的分析必须适应这些变化。基于类型的分析通常是此类分析中最简单的,但是由于语言的微妙习惯用法和许多特定于应用程序的需求——例如确保通用类型正确性、安全属性或正确的库使用——我们发现单一类型系统不能满足所有目的。然而,这些不同的用途仍然共享许多可重用的公共元素。在本文中,我们介绍了TeJaS,一个为JavaScript构建类型系统的框架。光辉战机被模块化设计以鼓励试验。它的初始类型环境是具体化的,这样可以方便地对JavaScript程序的各种执行上下文进行建模;它的类型语言和类型规则是可扩展的,这样可以方便地构造类型系统的变体。本文介绍了基本的TeJaS类型系统,该系统为JavaScript执行传统的类型检查。因为JavaScript需要复杂的类型,我们解释了几个设计决策来改进用户人机工程学。然后,我们描述了TeJaS的模块化结构,并通过重构一个非常不同的JavaScript类型系统的本质来说明它。由TeJaS构建的系统已经应用于几个现实世界的第三方JavaScript程序。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信