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

IF 1.5 2区 计算机科学 Q3 COMPUTER SCIENCE, SOFTWARE ENGINEERING
Friedrich Steimann
{"title":"Containerless Plurals: Separating Number from Type in Object-Oriented Programming","authors":"Friedrich Steimann","doi":"https://dl.acm.org/doi/10.1145/3527635","DOIUrl":null,"url":null,"abstract":"<p>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 <span>Num</span>, 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, <span>Num</span> 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, <span>Num</span> 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 <span>Num</span> in Prolog and accompanying type and number safety proofs are presented.</p>","PeriodicalId":50939,"journal":{"name":"ACM Transactions on Programming Languages and Systems","volume":"263 8","pages":""},"PeriodicalIF":1.5000,"publicationDate":"2022-09-21","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"ACM Transactions on Programming Languages and Systems","FirstCategoryId":"94","ListUrlMain":"https://doi.org/https://dl.acm.org/doi/10.1145/3527635","RegionNum":2,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q3","JCRName":"COMPUTER SCIENCE, SOFTWARE ENGINEERING","Score":null,"Total":0}
引用次数: 0

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.

无容器复数:面向对象编程中数字与类型的分离
为了让表达式求值为无对象或多个对象,大多数面向对象编程语言都需要使用特殊的结构,将这些情况编码为单个对象或值。虽然以惯用方式处理这些标准情况的要求似乎被广泛接受,但我认为它的替代方案,让表达式直接求值到任意数量的对象,有几个优点,值得考虑。作为概念的证明,我提出了一种核心的面向对象编程语言,称为Num,它将数字与类型分开,以便表达式的类型独立于它可能求值的对象的数量,从而消除了统一使用无、一个和多个对象的一个主要障碍。此外,Num放弃了空引用,用更一般的可数概念取代了引用类型的可空性,并允许在任意数量的对象上调用方法,包括不调用对象。为了使行为适应实际的接收者数量,Num用复数方法来补充实例方法,也就是说,用联合操作多个对象的方法来替代其他语言中已知的静态方法。给出了Num在Prolog中的一个实现,并给出了相应的类型和数的安全性证明。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
ACM Transactions on Programming Languages and Systems
ACM Transactions on Programming Languages and Systems 工程技术-计算机:软件工程
CiteScore
3.10
自引率
7.70%
发文量
28
审稿时长
>12 weeks
期刊介绍: ACM Transactions on Programming Languages and Systems (TOPLAS) is the premier journal for reporting recent research advances in the areas of programming languages, and systems to assist the task of programming. Papers can be either theoretical or experimental in style, but in either case, they must contain innovative and novel content that advances the state of the art of programming languages and systems. We also invite strictly experimental papers that compare existing approaches, as well as tutorial and survey papers. The scope of TOPLAS includes, but is not limited to, the following subjects: language design for sequential and parallel programming programming language implementation programming language semantics compilers and interpreters runtime systems for program execution storage allocation and garbage collection languages and methods for writing program specifications languages and methods for secure and reliable programs testing and verification of programs
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信