A1 Vertaisarvioitu alkuperäisartikkeli tieteellisessä lehdessä

Revisiting Language Support for Generic Programming: When Genericity Is a Core Design Goal




TekijätChetioui Benjamin, Järvi Jaakko, Haveraaen Magne

KustantajaAOSA, Inc.

Julkaisuvuosi2022

JournalThe Art, Science, and Engineering of Programming

Lehden akronyymiArt. sci. eng. program.

Artikkelin numero4

Vuosikerta7

Numero2

eISSN2473-7321

DOIhttps://doi.org/10.22152/programming-journal.org/2023/7/4

Verkko-osoitehttps://doi.org/10.22152/programming-journal.org/2023/7/4

Rinnakkaistallenteen osoitehttps://research.utu.fi/converis/portal/detail/Publication/177472106


Tiivistelmä
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.


Ladattava julkaisu

This is an electronic reprint of the original article.
This reprint may differ from the original in pagination and typographic detail. Please cite the original version.





Last updated on 2024-26-11 at 18:05