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 条
[31]   Object-oriented toolbox for spectral element analysis [J].
Dubois-Pelerin Y. ;
Van Kemenade V. ;
Deville M. .
Journal of Scientific Computing, 1999, 14 (1) :1-29
[32]   A logical foundation for deductive object-oriented databases [J].
Liu, MC ;
Dobbie, G ;
Ling, TW .
ACM TRANSACTIONS ON DATABASE SYSTEMS, 2002, 27 (01) :117-151
[33]   Simple typed intermediate language for object-oriented languages [J].
Chen, J ;
Tarditi, D .
ACM SIGPLAN NOTICES, 2005, 40 (01) :38-49
[34]   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
[36]   Data analysis/visualization for the object-oriented LHC era [J].
Adesanya, Y .
HEPVIS96 WORKSHOP ON VISUALIZATION IN HIGH-ENERGY PHYSICS, 1997, 97 (01) :127-132
[37]   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)
[38]   On type systems for object-oriented database programming languages [J].
Leontiev, Y ;
Özsu, MTR ;
Szafron, D .
ACM COMPUTING SURVEYS, 2002, 34 (04) :409-449
[39]   MI - AN OBJECT-ORIENTED ENVIRONMENT FOR INTEGRATION OF SCIENTIFIC APPLICATIONS [J].
SPINELLI, A ;
SALVANESCHI, P ;
CADEI, M ;
ROCCA, M .
SIGPLAN NOTICES, 1994, 29 (10) :212-222
[40]   AVS/Express - An object-oriented visual development tool [J].
Proix, B .
HEPVIS96 WORKSHOP ON VISUALIZATION IN HIGH-ENERGY PHYSICS, 1997, 97 (01) :69-76