【24h】

CZ: Multiple Inheritance Without Diamonds

机译:CZ:没有钻石的多重继承

获取原文
获取原文并翻译 | 示例

摘要

Multiple inheritance has long been plagued with the "diamond" inheritance problem, leading to solutions that restrict expressiveness, such as mixins and traits. Instead, we address the diamond problem directly, considering two difficulties it causes: ensuring a correct semantics for object initializers, and typechecking multiple dispatch in a modular fashion—the latter problem arising even with multiple interface inheritance. We show that previous solutions to these problems are either unsatisfactory or cumbersome, and suggest a novel approach: supporting multiple inheritance but forbidding diamond inheritance. Expressiveness is retained through two features: a "requires" construct that provides a form of subtyping without inheritance (inspired by Scala [40]), and a dynamically-dispatched "super" call similar to that found in traits. Through examples, we illustrate that inheritance diamonds can be eliminated via a combination of "requires" and ordinary inheritance. We provide a sound formal model for our language and demonstrate its modularity and expressiveness.
机译:长期以来,多重继承一直困扰着“钻石”继承问题,从而导致了限制表达性的解决方案,例如混合素和特征。相反,我们直接考虑菱形问题,要考虑它引起的两个困难:确保对象初始化程序的语义正确,并以模块化方式对多个调度进行类型检查-后者的问题甚至在具有多个接口继承时也会出现。我们表明,以前解决这些问题的方法要么不令人满意,要么繁琐,并提出了一种新颖的方法:支持多重继承但禁止钻石继承。表现力通过两个特征得以保留:“需要”构造提供一种无继承的子类型形式(受Scala启发[40]),以及动态分配的“超”调用,类似于特征中的调用。通过示例,我们说明可以通过结合“要求”和普通继承来消除继承钻石。我们为我们的语言提供了完善的正式模型,并展示了其模块化和表达能力。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号