Containerless Plurals: Separating Number from Type in Object-Oriented Programming

被引:3
作者
Steimann, Friedrich [1 ]
机构
[1] Fernuniv, D-58089 Hagen, Germany
来源
ACM TRANSACTIONS ON PROGRAMMING LANGUAGES AND SYSTEMS | 2022年 / 44卷 / 04期
关键词
Multiplicities in programming; collections; bunches; null-safety; object-relational programming; LANGUAGE; !text type='JAVA']JAVA[!/text;
D O I
10.1145/3527635
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
To let expressions evaluate to no or many objects, most object-oriented programming languages require the use of special constructs that encode these cases as single objects or values. While the requirement to treat these standard situations idiomatically seems to be broadly accepted, I argue that its alternative, letting expressions evaluate to any number of objects directly, has several advantages that make it worthy of consideration. As a proof of concept, I present a core object-oriented programming language, dubbed NUM, which separates number from type so that the type of an expression is independent of the number of objects it may evaluate to, thus removing one major obstacle to using no, one, and many objects uniformly. Furthermore, NUM abandons null references, replaces the nullability of reference types with the more general notion of countability, and allows methods to be invoked on any number of objects, including no object. To be able to adapt behavior to the actual number of receivers, NUM complements instance methods with plural methods, that is, with methods that operate on a number of objects jointly and that replace static methods known from other languages. An implementation of NUM in Prolog and accompanying type and number safety proofs are presented.
引用
收藏
页数:56
相关论文
共 65 条
[1]   Type Soundness Proofs with Definitional Interpreters [J].
Amin, Nada ;
Rompf, Tiark .
ACM SIGPLAN NOTICES, 2017, 52 (01) :666-679
[2]  
Arnold K., 2000, The Java Programming Language
[3]  
Balzer S, 2011, LECT NOTES COMPUT SC, V6813, P358, DOI 10.1007/978-3-642-22655-7_17
[4]  
Bierman G, 2005, LECT NOTES COMPUT SC, V3586, P262
[5]  
Bierman G., 2005, ECOOP 2005 - Object-Oriented Programming, 19th European Conference, P287, DOI [10.1007/11531142_13, DOI 10.1007/11531142_13]
[6]  
Bierman G, 2010, LECT NOTES COMPUT SC, V6183, P76, DOI 10.1007/978-3-642-14107-2_5
[7]  
Bierman GM, 2007, OOPSLA: 22ND INTERNATIONAL CONFERENCE ON OBJECT-ORIENTED PROGRAMMING, SYSTEMS, LANGUAGES, AND APPLICATIONS, PROCEEDINGS, P479
[8]  
Bierman Gavin M., 2003, UCAMCLTR563
[9]  
Brassel Bernd, 2004, J FUNCT LOG PROGRAM, V2004, P1