分离使用和重复使用以改善两者
Separating Use and Reuse to Improve Both
摘要:
上下文:特征组合激发了面向对象(OO)语言代码重用领域的新研究。这种组合的主要优点之一是它可以将子类化与子类化分开,这有利于代码重用,设计和推理。然而,在traits中处理状态是困难的、冗长的或不优雅的。咨询电话:我们确定这个泄漏问题的根本限制,防止在传统的面向对象语言的子类化的子类型的分离。我们解释了特征组合的概念解决了这个问题,通过区分设计用于使用的代码(作为一种类型)和设计用于重用的代码(即继承)。我们知道至少有3种具体的独立设计的研究语言遵循这种方法:TraitRecordJ,Package Templates和DeepFJig。方法:在本文中,我们设计了$42_μ$一个新的语言,我们提高了使用和重用,并支持这种类型和家庭的多态性,区分代码设计用于使用和代码设计用于重用。通过这种方式,$42_μ$综合了上述3种方法,并通过抽象状态操作对其进行了改进:一种在基于trait的语言中处理状态组合的新的优雅方法。知识与基础:使用案例研究,我们表明,$42_μ$的模型的特质与抽象的状态操作是更有用的和紧凑的比以前的工作。我们正式我们的工作,并证明类型错误不会产生良好的类型代码组成。重要性:这项工作是程序设计语言的逻辑核心。这表明,本文提出的思想可以适用于一个完整的通用语言。这种组合形式非常灵活,可以在许多新语言中使用。
英文摘要:
Context: Trait composition has inspired new research in the area of code reuse for object oriented (OO) languages. One of the main advantages of this kind of composition is that it makes possible to separate subtyping from subclassing; which is good for code-reuse, design and reasoning. However, handling of state within traits is difficult, verbose or inelegant. Inquiry: We identify the this-leaking problem as the fundamental limitation that prevents the separation of subtyping from subclassing in conventional OO languages. We explain that the concept of trait composition addresses this problem, by distinguishing code designed for use (as a type) from code designed for reuse (i.e. inherited). We are aware of at least 3 concrete independently designed research languages following this methodology: TraitRecordJ, Package Templates and DeepFJig. Approach: In this paper, we design $42_μ$ a new language, where we improve use and reuse and support the This type and family polymorphism by distinguishing code designed for use from code designed for reuse. In this way $42_μ$ synthesise the 3 approaches above, and improves them with abstract state operations: a new elegant way to handle state composition in trait based languages. Knowledge and Grounding: Using case studies, we show that $42_μ$'s model of traits with abstract state operations is more usable and compact than prior work. We formalise our work and prove that type errors cannot arise from composing well typed code. Importance: This work is the logical core of the programming language 42. This shows that the ideas presented in this paper can be applicable to a full general purpose language. This form of composition is very flexible and could be used in many new languages.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。