Dynamics for ML using Meta-Programming

  • Authors:
  • Thomas Gazagnaire;Anil Madhavapeddy

  • Affiliations:
  • INRIA Sophia Antipolis-Méditerranée, 2004 Route des Lucioles, BP 93, 06902 Sophia Antipolis Cedex, France;Computer Laboratory, 15 JJ Thomson Avenue, Cambridge CB3 0FD, UK

  • Venue:
  • Electronic Notes in Theoretical Computer Science (ENTCS)
  • Year:
  • 2011

Quantified Score

Hi-index 0.00

Visualization

Abstract

We present the design and implementation of dynamic type and value introspection for the OCaml language. Unlike previous attempts, we do not modify the core compiler or type-checker, and instead use the camlp4 metaprogramming tool to generate appropriate definitions at compilation time. Our dynamics library significantly eases the task of generating generic persistence and I/O functions in OCaml programs, without requiring the full complexity of fully-staged systems such as MetaOCaml. As a motivating use of the library, we describe a SQL backend which generates type-safe functions to persist and retrieve values from a relational database, without requiring programmers to ever use SQL directly.