Veröffentlichung
- Titel:
- Containerless Plurals: Separating Number from Type in Object-Oriented Programming
- AutorInnen:
- Friedrich Steimann
- Kategorie:
- Artikel in Zeitschriften
- erschienen in:
- ACM Trans. Program. Lang. Syst. 44(4): 21:1-21:56 (2022)
- Abstract:
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.
- Download:
- electronic edition via DOI (open access)