Code Reuse With Transformation Objects

02/06/2018
by   Dmitri Boulytchev, et al.
0

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 automatically derive most functionality from a slightly augmented type descriptions.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
06/02/2021

Generic Programming with Combinators and Objects

We present a generic programming framework for OCAML which makes it poss...
research
09/05/2022

Detecting Unjustified Assumptions in Subclasses via Elegant Objects Representation

Elegant Objects (EO) is a programming language based on ideas of pure ob...
research
05/26/2019

Programming with Applicative-like expressions

The fact that Applicative type class allows one to express simple parser...
research
09/14/2020

Should Decorators Preserve the Component Interface?

Decorator design pattern is a well known pattern that allows dynamical a...
research
07/09/2022

Subclasses of Class Function used to Implement Transformations of Statistical Models

A library of software for inductive inference guided by the Minimum Mess...
research
03/03/2010

Automatically Discovering Hidden Transformation Chaining Constraints

Model transformations operate on models conforming to precisely defined ...
research
01/26/2022

Understanding and Compressing Music with Maximal Transformable Patterns

We present a polynomial-time algorithm that discovers all maximal patter...

Please sign up or login with your details

Forgot password? Click here to reset