Adoption and focus:: Practical linear types for imperative programming

被引:57
作者
Fähndrich, M [1 ]
DeLine, R [1 ]
机构
[1] Microsoft Res, Redmond, WA 98052 USA
关键词
design; languages; reliability; verification; linear types; heap aliasing; region-based memory management;
D O I
10.1145/543552.512532
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
A type system with linearity is useful for checking software protocols and resource management at compile time. Linearity provides powerful reasoning about state changes, but at the price of restrictions on aliasing. The hard division between linear and nonlinear types forces the programmer to make a trade-off between checking a protocol on an object and aliasing the object. Most onerous is the restriction that any type with a linear component must itself be linear. Because of this, checking a protocol on an object imposes aliasing restrictions on any data structure that directly or indirectly points to the object. We propose a new type system that reduces these restrictions with the adoption and focus constructs. Adoption safely allows a programmer to alias objects on which she is checking protocols, and focus allows the reverse. A programmer can alias data structures that point to linear objects and use focus for safe access to those objects. We discuss how we implemented these ideas in the Vault programming language.
引用
收藏
页码:13 / 24
页数:12
相关论文
共 19 条
[1]  
*ACM SIGPLAN SIGAC, 1999, 26 ANN ACM SIGPLAN S
[2]  
[Anonymous], 1990, PROGRAMMING CONCEPTS
[3]   Alias burying: Unique variables without destructive reads [J].
Boyland, J .
SOFTWARE-PRACTICE & EXPERIENCE, 2001, 31 (06) :533-553
[4]  
CRARY K, 1999, 26 ANN ACM SIGPLAN S
[5]  
DELINE R, 2001, P 2001 ACM SIGPLAN C
[6]   Memory management with explicit regions [J].
Gay, D ;
Aiken, A .
ACM SIGPLAN NOTICES, 1998, 33 (05) :313-323
[7]  
HENGLEIN F, 2001, ACM C PRINC PRACT DE
[8]  
ISHITIAQ SS, 2001, 28 ANN ACM S PRINC P, P14
[9]  
KUNCAK V, 2002, 29 ANN ACM S PRINC P
[10]  
LEINO KRM, 2000, 160 SRC COMP