FHJ: A Formal Model for Hierarchical Dispatching and Overriding

Yanlin Wang, Haoyuan Zhang, B. C. D. S. Oliveira, M. Servetto
{"title":"FHJ: A Formal Model for Hierarchical Dispatching and Overriding","authors":"Yanlin Wang, Haoyuan Zhang, B. C. D. S. Oliveira, M. Servetto","doi":"10.4230/LIPIcs.ECOOP.2018.20","DOIUrl":null,"url":null,"abstract":"© Yanlin Wang, Haoyuan Zhang, Bruno C. d. S. Oliveira, and Marco Servetto. Multiple inheritance is a valuable feature for Object-Oriented Programming. However, it is also tricky to get right, as illustrated by the extensive literature on the topic. A key issue is the ambiguity arising from inheriting multiple parents, which can have conflicting methods. Numerous existing work provides solutions for conflicts which arise from diamond inheritance: i.e. conflicts that arise from implementations sharing a common ancestor. However, most mechanisms are inadequate to deal with unintentional method conflicts: conflicts which arise from two unrelated methods that happen to share the same name and signature. This paper presents a new model called Featherweight Hierarchical Java (FHJ) that deals with unintentional method conflicts. In our new model, which is partly inspired by C++, conflicting methods arising from unrelated methods can coexist in the same class, and hierarchical dispatching supports unambiguous lookups in the presence of such conflicting methods. To avoid ambiguity, hierarchical information is employed in method dispatching, which uses a combination of static and dynamic type information to choose the implementation of a method at run-time. Furthermore, unlike all existing inheritance models, our model supports hierarchical method overriding: that is, methods can be independently overridden along the multiple inheritance hierarchy. We give illustrative examples of our language and features and formalize FHJ as a minimal Featherweight-Java style calculus.","PeriodicalId":172012,"journal":{"name":"European Conference on Object-Oriented Programming","volume":"9 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2018-07-10","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"3","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"European Conference on Object-Oriented Programming","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.4230/LIPIcs.ECOOP.2018.20","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 3

Abstract

© Yanlin Wang, Haoyuan Zhang, Bruno C. d. S. Oliveira, and Marco Servetto. Multiple inheritance is a valuable feature for Object-Oriented Programming. However, it is also tricky to get right, as illustrated by the extensive literature on the topic. A key issue is the ambiguity arising from inheriting multiple parents, which can have conflicting methods. Numerous existing work provides solutions for conflicts which arise from diamond inheritance: i.e. conflicts that arise from implementations sharing a common ancestor. However, most mechanisms are inadequate to deal with unintentional method conflicts: conflicts which arise from two unrelated methods that happen to share the same name and signature. This paper presents a new model called Featherweight Hierarchical Java (FHJ) that deals with unintentional method conflicts. In our new model, which is partly inspired by C++, conflicting methods arising from unrelated methods can coexist in the same class, and hierarchical dispatching supports unambiguous lookups in the presence of such conflicting methods. To avoid ambiguity, hierarchical information is employed in method dispatching, which uses a combination of static and dynamic type information to choose the implementation of a method at run-time. Furthermore, unlike all existing inheritance models, our model supports hierarchical method overriding: that is, methods can be independently overridden along the multiple inheritance hierarchy. We give illustrative examples of our language and features and formalize FHJ as a minimal Featherweight-Java style calculus.
层次化调度与覆盖的形式化模型
©王彦林,张浩源,Bruno C. d. S. Oliveira, Marco Servetto。多重继承是面向对象编程的一个重要特性。然而,正如关于该主题的大量文献所说明的那样,要正确处理也很棘手。一个关键问题是继承多个父类所产生的歧义,这些父类可能具有冲突的方法。许多现有的工作都为钻石继承引起的冲突提供了解决方案:即由共享共同祖先的实现引起的冲突。然而,大多数机制都不足以处理无意的方法冲突:由于两个不相关的方法碰巧共享相同的名称和签名而产生的冲突。本文提出了一种新的模型,称为轻量级分层Java (FHJ),用于处理无意的方法冲突。在我们部分受c++启发的新模型中,由不相关方法产生的冲突方法可以共存于同一个类中,分层调度支持在存在这些冲突方法的情况下进行明确的查找。为了避免歧义,在方法调度中采用了层次信息,它使用静态和动态类型信息的组合来选择方法在运行时的实现。此外,与所有现有的继承模型不同,我们的模型支持分层方法重写:也就是说,方法可以沿着多个继承层次独立地被重写。我们给出了我们的语言和特性的说明性示例,并将FHJ形式化为最小的轻量级java风格演算。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
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学术文献互助群
群 号:604180095
Book学术官方微信