Logical Types for Untyped Languages

被引:0
|
作者
Tobin-Hochstadt, Sam [1 ]
Felleisen, Matthias [1 ]
机构
[1] Northeastern Univ, Boston, MA 02115 USA
关键词
Type systems; Untyped languages; Logic;
D O I
暂无
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Programmers reason about their programs using a wide variety of formal and informal methods. Programmers in untyped languages such as Scheme or Erlang are able to use any such method to reason about the type behavior of their programs. Our type system for Scheme accommodates common reasoning methods by assigning variable occurrences a subtype of their declared type based on the predicates prior to the occurrence, a discipline dubbed occurrence typing. It thus enables programmers to enrich existing Scheme code with types, while requiring few changes to the code itself. Three years of practical experience has revealed serious shortcomings of our type system. In particular, it relied on a system of ad-hoc rules to relate combinations of predicates, it could not reason about subcomponents of data structures, and it could not follow sophisticated reasoning about the relationship among predicate tests, all of which are used in existing code. In this paper, we reformulate occurrence typing to eliminate these shortcomings. The new formulation derives propositional logic formulas that hold when an expression evaluates to true or false, respectively. A simple proof system is then used to determine types of variable occurrences from these propositions. Our implementation of this revised occurrence type system thus copes with many more untyped programming idioms than the original system.
引用
收藏
页码:117 / 128
页数:12
相关论文
共 50 条
  • [1] Logical Types for Untyped Languages
    Tobin-Hochstadt, Sam
    Felleisen, Matthias
    ACM SIGPLAN NOTICES, 2010, 45 (09) : 117 - 128
  • [2] Adding Types to Untyped Languages
    Felleisen, Matthias
    TLDI '10: PROCEEDINGS OF THE 2010 ACM SIGPLAN WORKSHOP ON TYPES IN LANGUAGE DESIGN AND IMPLEMENTATION, 2010, : 1 - 1
  • [3] On polymorphic types of untyped terms
    Statman, Rick
    JOURNAL OF COMPUTER AND SYSTEM SCIENCES, 2014, 80 (06) : 1163 - 1173
  • [4] On Polymorphic Types of Untyped Terms
    Statman, Rick
    LOGIC, LANGUAGE, INFORMATION AND COMPUTATION, WOLLIC 2011, 2011, 6642 : 239 - 256
  • [5] Untyped Recursion Schemes and Infinite Intersection Types
    Tsukada, Takeshi
    Kobayashi, Naoki
    FOUNDATIONS OF SOFTWARE SCIENCE AND COMPUTATIONAL STRUCTURES, PROCEEDINGS, 2010, 6014 : 343 - 357
  • [6] Are Logical Languages Compositional?
    Marcus Kracht
    Studia Logica, 2013, 101 : 1319 - 1340
  • [7] Are Logical Languages Compositional?
    Kracht, Marcus
    STUDIA LOGICA, 2013, 101 (06) : 1319 - 1340
  • [8] LLM-enhanced evolutionary test generation for untyped languages
    Yang, Ruofan
    Xu, Xianghua
    Wang, Ran
    AUTOMATED SOFTWARE ENGINEERING, 2025, 32 (01)
  • [9] ON LANGUAGES WITH CONSTRUCTIVE LOGICAL CONNECTIVES
    PLISKO, VE
    DOKLADY AKADEMII NAUK SSSR, 1987, 296 (01): : 35 - 38
  • [10] LOGICAL DIVERSITY OF NATURAL LANGUAGES
    KEENAN, EL
    ANNALS OF THE NEW YORK ACADEMY OF SCIENCES, 1976, 280 (OCT28) : 73 - 91