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 条
[41]   Object-Oriented Recovery for Non-volatile Memory [J].
Cohen N. ;
Aksun D.T. ;
Larus J.R. .
Proceedings of the ACM on Programming Languages, 2018, 2 (OOPSLA)
[42]   Perfect class hashing and numbering for object-oriented implementation [J].
Ducournau, Roland ;
Morandat, Floreal .
SOFTWARE-PRACTICE & EXPERIENCE, 2011, 41 (06) :661-694
[43]   TROLL - A language for object-oriented specification of information systems [J].
Jungclaus, R ;
Saake, G ;
Hartmann, T ;
Sernadas, C .
ACM TRANSACTIONS ON INFORMATION SYSTEMS, 1996, 14 (02) :175-211
[44]   Object-Oriented Recovery for Non-volatile Memory [J].
Cohen, Nachshon ;
Aksun, David T. ;
Larus, James R. .
PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2018, 2
[45]   Open issues in object-oriented programming - A Scandinavian perspective [J].
Madsen, OL .
SOFTWARE-PRACTICE & EXPERIENCE, 1995, 25 :3-43
[46]   Associating synchronization constraints with data in an object-oriented language [J].
Vaziri, M ;
Tip, F ;
Dolby, J .
ACM SIGPLAN NOTICES, 2006, 41 (01) :334-345
[47]   Science Code .Net: Object-oriented programming for science [J].
Chung, Myung-Hoon .
SCIENCE OF COMPUTER PROGRAMMING, 2008, 71 (03) :242-247
[48]   ThisType for Object-Oriented Languages: From Theory to Practice [J].
Ryu, Sukyoung .
ACM TRANSACTIONS ON PROGRAMMING LANGUAGES AND SYSTEMS, 2016, 38 (03)
[49]   Object-oriented programming in nonlinear finite element analysis [J].
Dubois-Pelerin, Y ;
Pegon, P .
COMPUTERS & STRUCTURES, 1998, 67 (04) :225-241
[50]   Language Support for Generic Programming in Object-Oriented Languages: Peculiarities, Drawbacks, Ways of Improvement [J].
Belyakova, Julia .
PROGRAMMING LANGUAGES (SBLP 2016), 2016, 9889 :1-15