Affiliation:
1. Cornell University, USA
Abstract
Parametric polymorphism and inheritance are both important, extensively explored language mechanisms for providing code reuse and extensibility. But harmoniously integrating these apparently distinct mechanisms—and powerful recent forms of them, including type classes and family polymorphism—in a single language remains an elusive goal. In this paper, we show that a deep unification can be achieved by generalizing the semantics of interfaces and classes. The payoff is a significant increase in expressive power with little increase in programmer-visible complexity. Salient features of the new programming language include retroactive constraint modeling, underpinning both object-oriented programming and generic programming, and module-level inheritance with further-binding, allowing family polymorphism to be deployed at large scale. The resulting mechanism is syntactically light, and the more advanced features are transparent to the novice programmer. We describe the design of a programming language that incorporates this mechanism; using a core calculus, we show that the type system is sound. We demonstrate that this language is highly expressive by illustrating how to use it to implement highly extensible software and by showing that it can not only concisely model state-of-the-art features for code reuse, but also go beyond them.
Publisher
Association for Computing Machinery (ACM)
Subject
Safety, Risk, Reliability and Quality,Software
Cited by
7 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Persimmon: Nested Family Polymorphism with Extensible Variant Types;Proceedings of the ACM on Programming Languages;2024-04-29
2. The Online Pause and Resume Problem: Optimal Algorithms and An Application to Carbon-Aware Load Shifting;Proceedings of the ACM on Measurement and Analysis of Computing Systems;2023-12-07
3. Near-optimal Online Algorithms for Joint Pricing and Scheduling in EV Charging Networks;Proceedings of the 14th ACM International Conference on Future Energy Systems;2023-06-16
4. Extensible Metatheory Mechanization via Family Polymorphism;Proceedings of the ACM on Programming Languages;2023-06-06
5. The Online Knapsack Problem with Departures;Proceedings of the ACM on Measurement and Analysis of Computing Systems;2022-12