xvw.lol - Guarded methods in OCaml

A technical note on encoding guarded methods in OCaml with a type equality witness.

Author
Not stated (site: xvw.lol)
Published
2025-06-29
Kind
Personal technical note, translated from French, with working code
Original
xvw.lol/en/articles/oop-refl.html
Subject
Programming languages and types

What it is

The page names no author and is a translation of a note in French. It starts from slides by Gabriel Scherer on object-oriented and functional symmetry.

What it says

What evidence it gives

The note gives OCaml code for an object list class with flatten and sum methods. It shows assertions and the compiler error for a wrong call. It reports no wider tests.

Interests and limits

This is a personal note on one example. The author says OOP is rarely encouraged in OCaml, so this is probably not useful. The code was not run for this page. The author is not named.