Constrained Types for Object-Oriented Languages

被引:2
作者
Nystrom, Nathaniel [1 ]
Saraswat, Vijay [1 ]
Palsberg, Jens [2 ]
Grothoff, Christian [3 ]
机构
[1] IBM Corp, Thomas J Watson Res Ctr, Yorktown Hts, NY 10598 USA
[2] Univ Calif Los Angeles, Dept Comp Sci, Los Angeles, CA 90095 USA
[3] Univ Denver, Dept Comp Sci, Denver, CO 80208 USA
关键词
Languages;
D O I
10.1145/1449955.1449800
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
X10 is a modern object-oriented language designed for productivity and performance in concurrent and distributed systems. In this setting, dependent types offer significant opportunities for detecting design errors statically, documenting design decisions, eliminating costly run-time checks (e. g., for array bounds, null values), and improving the quality of generated code. We present the design and implementation of constrained types, a natural, simple, clean, and expressive extension to object-oriented programming: A type C{c} names a class or interface C and a constraint c on the immutable state of C and in-scope final variables. Constraints may also be associated with class definitions (representing class invariants) and with method and constructor definitions (representing preconditions). Dynamic casting is permitted. The system is parametric on the underlying constraint system: the compiler supports a simple equality-based constraint system but, in addition, supports extension with new constraint systems using compiler plugins.
引用
收藏
页码:457 / 474
页数:18
相关论文
共 64 条
[1]  
AIKEN A, 1994, P S PRINC PROGR LANG, P163, DOI DOI 10.1145/174675.177847
[2]  
Ait-Kaci H., 1984, A Lattice Theoretic Approach to Computation Based on a Calculus of Partially Ordered Type Structures
[3]  
ALTENKIRCH T, 2005, WHY DEPENDENT TYPES
[4]  
[Anonymous], 1998, PROC 3 ACM SIGPLAN I, DOI DOI 10.1145/289423.289451
[5]  
Barrett C, 2004, LECT NOTES COMPUT SC, V3114, P515
[6]  
Bracha G., 2004, OOPSLA 04 WORKSH REV
[7]  
Flanagan C., 2002, P ACM SIGPLAN C PROG
[8]  
FLANAGAN C, 2006, POPL, P245
[9]  
FOGARTY S, 2007, PEPM, P112
[10]   Flow-sensitive type qualifiers [J].
Foster, JS ;
Terauchi, T ;
Aiken, A .
ACM SIGPLAN NOTICES, 2002, 37 (05) :1-12