WG211/M12Kiselyov
MetaOCaml lives on by Oleg Kiselyov
MetaOCaml is a superset of OCaml extending it with staging annotations to construct and run typed code values. It was originally implemented by Taha, Calcagno and collaborators and was successfully used for specializing numeric and dynamic programming algorithms, building FFT kernels, optimizing compilers for DSL for image processing, OCaml server pages, etc. Unfortunately, due to lack of resources MetaOCaml fell behind OCaml. The large differences between OCaml and its dialect has contributed to the difficulty of maintaining MetaOCaml.
This talk reports on the compete re-implementation of MetaOCaml, called BER MetaOCaml N100. It is a superset of the current 4.001 version of OCaml. BER MetaOCaml has been re-structured to minimize the number of changes to the OCaml type-checker and to separate the `kernel' (type-checking and constructing code values) from the `user-level'. Various ways of running the code -- compiling to byte-code or machine instructions and executing them, or translating code values to C or LLVM, or printing them -- can be done in `user-level' libraries, without any need to hack into (Meta)OCaml. Maintaining the kernel and keeping it up to date should be much easier now. Also easier should be contributing to MetaOCaml.
We will illustrate a notable new feature: scope extrusion check. Attempting to build code values with unbound or mistakenly bound variables (which is possible with mutation or other effects) is now caught early, raising an exception with good diagnostics.
Active development, new modular structure, new features of MetaOCaml will hopefully attract more users and contributors, and incite future research into type-safe meta-programming.