We have recently been discussing OCaml pain points and dune came up a lot. I thought I would add a point which came to mind: the design of the dune configuration (s-exp) language. My critique is not what you might be thinking–although an s-expression syntax is a bit of an odd choice, ultimately it’s not a showstopper. The problem I am having is that the language itself is just not very well designed.
For example, the dune language allows describing various components:
- library
- executable
- executables
- test
This means we can have (library ...), (executable ...), etc. stanzas and they share various common fields like (name ...), (libraries ...). The problem is that this makes it difficult to talk about and effectively describe the dune file contents to people. When they ask how to add a library dependency, we have to say ‘add it to the (libraries ...) field in your dune file’s (executable ...) stanza, or the (library ...) stanza, or whatever stanza you have’. Sure, we can say ‘add the (libraries ...) field to your component’s stanza’, but ‘component’ is such a generic name that no one will remember what it is.
If the components were all described by a (component ...) stanza:
(component
(name main)
(type executable) ; or library/test/etc.
...)
We could just say ‘add the (libraries ...) field to your (component ...) stanza’.
I see a couple of other places where the language could be improved, but I won’t make this post too long right now. My 2c.