首页> 外文期刊>Information and computation >Featherweight Jigsaw — Replacing inheritance by composition in Java-like languages
【24h】

Featherweight Jigsaw — Replacing inheritance by composition in Java-like languages

机译:轻量级拼图—用类Java语言的组合替换继承

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

摘要

We present FJic, a simple calculus where basic building blocks are classes in the style of Featherweight Java, declaring fields, methods and one constructor. However, inheritance has been generalized to the much more flexible notion originally proposed in Bracha's Jigsaw framework. That is, classes play also the role of modules, that can be composed by a rich set of operators, all of which can be expressed by a minimal core. Fields and methods can be declared of four different kinds (abstract, virtual, frozen, local) determining how they are affected by the operators. We keep the nominal approach of Java-like languages, that is, types are class names. However, a class is not necessarily a structural subtype of any class used in its defining expression. While this allows a more flexible reuse, it may prevent the (generalized) inheritance relation from being a subtyping relation. So, the required subtyping relations among classes are declared by the programmer and checked by the type system. The calculus allows the encoding of a large variety of different mechanisms for software composition in class-based languages, including standard inheritance, mixin classes, traits and hiding. Hence, FJic can be used as a unifying framework for analyzing existing mechanisms and proposing new extensions. We provide two different semantics of an FJic program: flattening and direct semantics. The difference is analogous to that between two intuitive models to understand inheritance: the former where inherited methods are copied into heir classes, and the latter where member lookup is performed by ascending the inheritance chain. Here we address equivalence of these two views for a more sophisticated composition mechanism.
机译:我们介绍FJic,这是一个简单的演算,其中的基本构建块是Featherweight Java风格的类,声明了字段,方法和一个构造函数。但是,继承已经推广到最初在Bracha的Jigsaw框架中提出的更为灵活的概念。也就是说,类还扮演模块的角色,这些模块可以由一组丰富的运算符组成,所有这些运算符都可以由一个最小的核心表示。可以声明四种不同类型(抽象,虚拟,冻结,本地)的字段和方法,以确定它们如何受到操作员的影响。我们保留类Java语言的名义方法,即类型是类名。但是,类不一定是其定义表达式中使用的任何类的结构子类型。虽然这允许更灵活的重用,但它可以防止(通用)继承关系成为子类型关系。因此,类之间所需的子类型关系由程序员声明并由类型系统检查。演算允许使用基于类的语言对软件组成的多种不同机制进行编码,包括标准继承,mixin类,特征和隐藏。因此,FJic可以用作分析现有机制和提出新扩展的统一框架。我们提供FJic程序的两种不同的语义:展平和直接语义。区别类似于两个用于理解继承的直观模型之间的区别:前者将继承的方法复制到继承类中,后者将成员查询通过提升继承链来执行。在这里,我们讨论这两种视图的等效性,以获得更复杂的合成机制。

著录项

  • 来源
    《Information and computation》 |2012年第5期|p.86-111|共26页
  • 作者单位

    DISl, University of Genova, v. Dodecaneso 35, 16146 Genova, Italy;

    DISl, University of Genova, v. Dodecaneso 35, 16146 Genova, Italy;

    DISl, University of Genova, v. Dodecaneso 35, 16146 Genova, Italy;

  • 收录信息 美国《科学引文索引》(SCI);美国《工程索引》(EI);
  • 原文格式 PDF
  • 正文语种 eng
  • 中图分类
  • 关键词

相似文献

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

客服邮箱:kefu@zhangqiaokeyan.com

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

  • 服务号