论文标题
重新访问通用编程的语言支持:当通用性是核心设计目标时
Revisiting Language Support for Generic Programming: When Genericity Is a Core Design Goal
论文作者
论文摘要
上下文:Stepanov所定义的通用编程是一种通过仅考虑其基础数据类型和操作的所需属性来编写有效且可重复使用的算法的方法。事实证明,通用编程是用支持它的语言来构建可重复使用的软件组件库的有效手段。与仿制药相关的语言设计选择在实践中如何有利的通用编程中起着重要作用。 查询:首先创建了几种主流编程语言(例如Java和C ++),而无需仿制药。稍后逐渐添加支持通用编程的功能。因此,许多有关支持通用编程的文献都集中在将通用编程改造为现有语言并确定相关实施挑战。编程使用用于通用编程的语言而没有先验语言设计选择的限制时,该编程的经验是否会明显更好? 方法:我们检查了一种旨在体现通用编程的语言。木兰代表了一种基于代数规格的语言设计方法。我们重复了一个著名的实验,在该实验中,我们通过实施Boost Grapt库的子集并反思了我们的开发经验,将Magnolia的通用编程设施仔细审查。 知识:我们发现,在以前的研究中,识别为支持Stepanov风格的通用编程的关键特征,并且在主题上进行工作并没有讲述完整的故事。我们阐明了哪些更多是达到目的的手段,而不是支持通用编程的基本功能。根据木兰的开发经验,我们将变量确定为通用编程的另一个关键功能,并指出属性构成通用性的局限性和挑战。 基础:我们的工作使用了一个著名的框架来评估文献中语言的通用编程设施,以通过木兰评估代数方法,我们与众所周知的编程语言进行了比较。 重要性:这项工作给出了通用编程的全新视角,并在考虑支持Stepanov风格的通用编程时阐明了什么是基本语言属性及其权衡。对如何为通用编程设定基础的理解将为未来的语言设计提供信息。
Context: Generic programming, as defined by Stepanov, is a methodology for writing efficient and reusable algorithms by considering only the required properties of their underlying data types and operations. Generic programming has proven to be an effective means of constructing libraries of reusable software components in languages that support it. Generics-related language design choices play a major role in how conducive generic programming is in practice. Inquiry: Several mainstream programming languages (e.g. Java and C++) were first created without generics; features to support generic programming were added later, gradually. Much of the existing literature on supporting generic programming focuses thus on retrofitting generic programming into existing languages and identifying related implementation challenges. Is the programming experience significantly better, or different when programming with a language designed for generic programming without limitations from prior language design choices? Approach: We examine Magnolia, a language designed to embody generic programming. Magnolia is representative of an approach to language design rooted in algebraic specifications. We repeat a well-known experiment, where we put Magnolia's generic programming facilities under scrutiny by implementing a subset of the Boost Graph Library, and reflect on our development experience. Knowledge: We discover that the idioms identified as key features for supporting Stepanov-style generic programming in the previous studies and work on the topic do not tell a full story. We clarify which of them are more of a means to an end, rather than fundamental features for supporting generic programming. Based on the development experience with Magnolia, we identify variadics as an additional key feature for generic programming and point out limitations and challenges of genericity by property. Grounding: Our work uses a well-known framework for evaluating the generic programming facilities of a language from the literature to evaluate the algebraic approach through Magnolia, and we draw comparisons with well-known programming languages. Importance: This work gives a fresh perspective on generic programming, and clarifies what are fundamental language properties and their trade-offs when considering supporting Stepanov-style generic programming. The understanding of how to set the ground for generic programming will inform future language design.