xvw.lol

Index

Hello, my name is Xavier Van de Woestyne, and you've landed on the index of my personal website (though it doesn't deal much with personal things, so it's fine). This page is an English-language summary of my personal website (written in French); it essentially follows the structure of a traditional blog.

Essays and ramblings

Here is a list of articles/translations on various subjects, such as OCaml.


  • OCaml, modules, and import schemes

    The OCaml module system can be intimidating, and it typically involves the use of many keywords—for example, open and include, which allow importing definitions into a module. Since version OCaml 4.08, the open primitive has been generalized to allow the opening of arbitrary module expressions. In this article, we’ll explore how to use this generalization to reproduce a common practice in other languages, what I somewhat pompously call import strategies, to describe patterns like import {a, b as c} from K, without relying on a (sub-)language dedicated specifically to importing.

    • programming
    • ocaml
    • modules

  • Guarded methods in OCaml

    Guarded methods allow attaching constraints to the receiver (self) only for certain methods, thus allowing these methods to be called only if the receiver satisfies these constraints (these guards). OCaml does not syntactically allow defining this kind of method directly. In this note, we will see how to encode them using a type equality witness.

    • programming
    • type
    • oop
    • ocaml
    • gadt