Associated types and constraint propagation for mainstream object-oriented generics

被引:7
作者
Järvi, J
Willcock, J
Lumsdaine, A
机构
[1] Texas A&M Univ, College Stn, TX 77843 USA
[2] Indiana Univ, Open Syst Lab, Bloomington, IN 47405 USA
关键词
languages; generics; generic programming; constraint propagation; associated types; C#; !text type='Java']Java[!/text;
D O I
10.1145/1103845.1094813
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Support for object-oriented programming has become an integral part of mainstream languages, and more recently generic programming has gained widespread acceptance as well. A natural question is how these two paradigms, and their underlying language mechanisms, should interact. One particular design option, that of using subtyping to constrain the type parameters of generic functions, has been chosen in the generics of Java and those planned for a future revision of C#. Certain shortcomings have previously been identified in using subtyping for constraining paranietric polymorphism in the context of generic programming. To address these, we propose extending object-oriented interfaces and subtyping to include associated types and constraint propagation. Associated types are type members of interfaces and classes. Constraint propagation allows certain constraints on type parameters to be inferred from other constraints on those parameters and their use in base class type expressions. The paper demonstrates these extensions in the context of C# (with generics), describes a, translation of the extended features to C#, and presents a formalism proving their safety. The formalism is applicable to other mainstream object-oriented languages supporting F-bounded polymorphism, such as Java.
引用
收藏
页码:1 / 19
页数:19
相关论文
共 50 条
[21]   A STUDY OF SDAI IMPLEMENTATION ON OBJECT-ORIENTED DATABASES [J].
GOH, A ;
HUI, SC ;
SONG, B ;
WANG, FY .
COMPUTER STANDARDS & INTERFACES, 1994, 16 (01) :33-43
[22]   A STEP/EXPRESS to object-oriented database translator [J].
Goh, A ;
Hui, SC ;
Song, B .
FOURTH INTERNATIONAL CONFERENCE ON COMPUTER-AIDED DESIGN AND COMPUTER GRAPHICS, 1996, 2644 :530-537
[23]   Inferable Object-Oriented Typed Assembly Language [J].
Tate, Ross ;
Chen, Juan ;
Hawblitzel, Chris .
ACM SIGPLAN NOTICES, 2010, 45 (06) :424-435
[24]   OBJECT-ORIENTED PROGRAMMING ENVIRONMENTS - REQUIREMENTS AND APPROACHES [J].
BISCHOFBERGER, WR ;
KOFLER, T ;
SCHAFFER, B .
SOFTWARE-CONCEPTS AND TOOLS, 1994, 15 (02) :49-60
[25]   PARALLEL OBJECT-ORIENTED PROGRAMMING WITH QPC++ [J].
BOLES, D .
STRUCTURED PROGRAMMING, 1993, 14 (04) :158-172
[26]   Unifying Aspect- and Object-Oriented Design [J].
Rajan, Hridesh ;
Sullivan, Kevin J. .
ACM TRANSACTIONS ON SOFTWARE ENGINEERING AND METHODOLOGY, 2009, 19 (01) :1-41
[27]   A logic for information flow in object-oriented programs [J].
Amtoft, T ;
Bandhakavi, S ;
Banerjee, A .
ACM SIGPLAN NOTICES, 2006, 41 (01) :91-102
[28]   Object-oriented design of a cotton crop model [J].
Lemmon, H ;
Chuk, N .
ECOLOGICAL MODELLING, 1997, 94 (01) :45-51
[29]   Scandinavian Contributions to Object-Oriented Modeling Languages [J].
Moller-Pedersen, Birger .
HISTORY OF NORDIC COMPUTING 3, 2011, 350 :339-349
[30]   Flexible multibody dynamics - An object-oriented approach [J].
Anantharaman, M .
NONLINEAR DYNAMICS, 1996, 9 (1-2) :205-221