What are the biggest reasons newcomers give up on OCaml?

I’ve been using MDX for tests recently. Most of Eio’s tests are like this, for example:

Some benefits:

  1. You don’t have to write printers for values, because you have a top-level environment with the types from the compiler.

  2. This makes it easy to dump the whole output, rather than just probing a few properties.

  3. The format encourages you to comment the test cases, group them under headings, etc.

  4. If you change something in the code, it automatically generates a diff showing how the test output changes, and you can just choose to accept it (dune runtest --autopromote).

It has some problems too, though:

  1. There’s no support for skipping tests on certain platforms (e.g. for Windows-only tests, or skipping IPv6 tests on platforms without that).

  2. No merlin or ocp-indent support when editing the files.

  3. Hard to see output-so-far if a test hangs (have to hunt around in /tmp for the output file).

  4. Everything runs as byte-code, so it won’t find bugs specific to native code.

2 Likes