Code Reuse With Transformation Objects
Dmitri Boulytchev

TL;DR
This paper introduces a lightweight, datatype-generic programming approach in Objective Caml that uses transformation objects for code reuse, enabling flexible, object-oriented modifications without altering data representations.
Contribution
It presents a novel method for implementing transformations via object-encoded objects, facilitating inheritance and extension while preserving data structure integrity.
Findings
Supports regular and polymorphic variant types
Enables combining data types from separate components
Automates derivation of transformation functionalities
Abstract
We present an approach for a lightweight datatype-generic programming in Objective Caml programming language aimed at better code reuse. We show, that a large class of transformations usually expressed via recursive functions with pattern matching can be implemented using the single per-type traversal function and the set of object-encoded transformations, which we call transformation objects. Object encoding allows transformations to be modified, inherited and extended in a conventional object-oriented manner. However, the data representation is kept untouched which preserves the ability to construct and pattern-match it in the usual way. Our approach equally works for regular and polymorphic variant types which makes it possible to combine data types and their transformations from statically typed and separately compiled components. We also present an implementation which allows us to…
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.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsLogic, programming, and type systems · Model-Driven Software Engineering Techniques · Software Engineering Research
