Separating Use and Reuse to Improve Both
Hrshikesh Arora (Victoria University of Wellington, New Zealand),, Marco Servetto (Victoria University Wellington, New Zealand), Bruno C. D. S., Oliveira (The University of Hong Kong, Hong Kong)

TL;DR
This paper introduces a new language, $42_$, that enhances code reuse and type safety in trait-based programming by separating use from reuse and supporting abstract state operations, addressing key limitations of traditional object-oriented languages.
Contribution
It designs $42_$, a language that synthesizes existing trait composition approaches with improved state handling, enabling better separation of use and reuse in object-oriented programming.
Findings
$42_$ supports abstract state operations for better state management.
The model reduces type errors in trait composition.
Case studies show improved usability and compactness.
Abstract
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 a…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
