Capturing Types

被引:5
作者
Boruch-Gruszecki, Aleksander [1 ]
Odersky, Martin [1 ]
Lee, Edward [2 ]
Lhotak, Ondrej [2 ]
Brachthaeuser, Jonathan [3 ]
机构
[1] Ecole Polytech Fed Lausanne, Lausanne, Switzerland
[2] Univ Waterloo, Waterloo, ON, Canada
[3] Karls Univ Tubingen, Tubingen, Germany
来源
ACM TRANSACTIONS ON PROGRAMMING LANGUAGES AND SYSTEMS | 2023年 / 45卷 / 04期
基金
加拿大自然科学与工程研究理事会;
关键词
Scala; type systems; effects; resources; capabilities;
D O I
10.1145/3618003
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Type systems usually characterize the shape of values but not their free variables. However, many desirable safety properties could be guaranteed if one knew the free variables captured by values. We describe CC<:square, a calculus where such captured variables are succinctly represented in types, and show it can be used to safely implement effects and effect polymorphism via scoped capabilities. We discuss how the decision to track captured variables guides key aspects of the calculus, and show that CC<:square admits simple and intuitive types for common data structures and their typical usage patterns. We demonstrate how these ideas can be used to guide the implementation of capture checking in a practical programming language.
引用
收藏
页数:52
相关论文
共 53 条
  • [1] Amin Nada, 2016, A List of Successes that can Change the World. Essays Dedicated to Philip Wadler on the Occasion of his 60th Birthday. LNCS 9600, P249, DOI 10.1007/978-3-319-30936-1_14
  • [2] [Anonymous], 2002, Types and Programming Languages
  • [3] Reachability Types: Tracking Aliasing and Separation in Higher-Order Functional Programs
    Bao, Yuyan
    Wei, Guannan
    Bracevac, Oliver
    Jiang, Yuxuan
    He, Qiyang
    Rompf, Tiark
    [J]. PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2021, 5 (OOPSLA):
  • [4] Barendsen E., 1996, Mathematical Structures in Computer Science, V6, P579
  • [5] Binders by Day, Labels by Night Effect Instances via Lexically Scoped Handlers
    Biernacki, Dariusz
    Pirog, Maciej
    Polesiuk, Piotr
    Sieczkowski, Filip
    [J]. PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2020, 4 (POPL):
  • [6] BOHM C, 1985, THEOR COMPUT SCI, V39, P135, DOI 10.1016/0304-3975(85)90135-5
  • [7] Boruch-Gruszecki Aleksander, 2021, arXiv
  • [8] Boyland J., 2001, ECOOP 2001 - Object-Oriented Programming. 15th European Conference. Proceedings (Lecture Notes in Computer Science Vol.2072), P2
  • [9] Bracha G, 2010, LECT NOTES COMPUT SC, V6183, P405, DOI 10.1007/978-3-642-14107-2_20
  • [10] Effects, Capabilities, and Boxes From Scope-Based Reasoning to Type-Based Reasoning and Back
    Brachthaeuser, Jonathan Immanuel
    Schuster, Philipp
    Lee, Edward
    Boruch-Gruszecki, Aleksander
    [J]. PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2022, 6 (OOPSLA):