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

11/03/2022
by   Benjamin Chetioui, et al.
0

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.

READ FULL TEXT

page 7

page 9

page 11

page 12

page 13

page 18

page 28

page 29

research
03/31/2018

Generic Description of Well-Scoped, Well-Typed Syntaxes

We adapt the technique of type-generic programming via descriptions poin...
research
11/19/2021

Types for Tables: A Language Design Benchmark

Context: Tables are ubiquitous formats for data. Therefore, techniques f...
research
07/29/2021

An Empirical Study of Developers' Discussions about Security Challenges of Different Programming Languages

Given programming languages can provide different types and levels of se...
research
10/31/2018

Structured Parallel Programming Language Based on True Concurrency

Based on our previous work on algebraic laws for true concurrency, we de...
research
07/17/2018

Merlin: A Language Server for OCaml (Experience Report)

We report on the experience of developing Merlin, a language server for ...
research
12/19/2018

Exposing A Customizable, Decentralized Cryptoeconomy as a Data Type

Purposely modular, this protocol enables customization of several protoc...
research
01/29/2020

A Type and Scope Safe Universe of Syntaxes with Binding: Their Semantics and Proofs

Almost every programming language's syntax includes a notion of binder a...

Please sign up or login with your details

Forgot password? Click here to reset