...
首页> 外文期刊>Science of Computer Programming >Design and evaluation of C++ open multi-methods
【24h】

Design and evaluation of C++ open multi-methods

机译:C ++开放式多方法的设计和评估

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

摘要

Multiple dispatch - the selection of a function to be invoked based on the dynamic type of two or more arguments - is a solution to several classical problems in object-oriented programming. Open multi-methods generalize multiple dispatch towards open-class extensions, which improve separation of concerns and provisions for retroactive design. We present the rationale, design, implementation, performance, programming guidelines, and experiences of working with a language feature, called open multi-methods, for C++. Our open multi-methods support both repeated and virtual inheritance. Our call resolution rules generalize both virtual function dispatch and overload resolution semantics. After using all information from argument types, these rules can resolve further ambiguities by using covariant return types. Care was taken to integrate open multi-methods with existing C++ language features and rules. We describe a model implementation and compare its performance and space requirements to existing open multi-method extensions and workaround techniques for C++. Compared to these techniques, our approach is simpler to use, catches more user mistakes, and resolves more ambiguities through link-time analysis, is comparable in memory usage, and runs significantly faster. In particular, the runtime cost of calling an open multi-method is constant and less than the cost of a double dispatch (two virtual function calls). Finally, we provide a sketch of a design for open multi-methods in the presence of dynamic loading and linking of libraries.
机译:多重调度(基于两个或多个参数的动态类型来选择要调用的函数)是解决面向对象编程中若干经典问题的解决方案。开放的多方法将多个派遣推广到开放类扩展,从而改善了关注点和追溯设计的分离。我们介绍使用C ++的语言功能(称为开放式多方法)的原理,设计,实现,性能,编程准则和经验。我们的开放式多方法支持重复继承和虚拟继承。我们的调用解析规则概括了虚拟函数调度和过载解析语义。在使用了自变量类型的所有信息之后,这些规则可以通过使用协变量返回类型来解决更多的歧义。注意将开放的多方法与现有的C ++语言功能和规则集成在一起。我们描述了一个模型实现,并将其性能和空间要求与C ++现有的开放式多方法扩展和解决方法进行了比较。与这些技术相比,我们的方法更易于使用,可捕获更多用户错误,并通过链接时分析解决更多歧义,在内存使用方面具有可比性,并且运行速度明显更快。特别是,调用开放式多方法的运行时成本是恒定的,并且比两次调度(两次虚拟函数调用)的成本低。最后,在存在动态加载和链接库的情况下,我们提供了开放式多方法设计的草图。

著录项

相似文献

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

客服邮箱:kefu@zhangqiaokeyan.com

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

  • 服务号