UP | HOME

Ocamlformat

Can we just stop that outrageous idiocy of automatically converting small functions into a singe line when it, please?

First, Ocaml is not Go and the one enforced formatting for all code cannot be applied here. Go is especially designed to be “primitive”, while Ocaml has long tradition and several cultures which goes back to ML.

Second, there is a couple of fundamental principles:

Functions on recursive types tend to be recursive and thus to have a particular shape which can be seen at a glance.

Functions on sum-types (defined by pattern-matching on data-constructors, which is the way) reflect the exact shape of the type declaration.

Again, converting small types and small functions into one-liners is outrageously stupid. It just throws the shape information and syntactic form clues out of the window for literally nothing.

There is a long tradition of writing multy-clause functions by pattern-matching in at least Standard ML and Erlang. Ocaml also has the function syntactic form because it is convenient.

Yes, the seemingly archaic term syntactic form is what we are dealing with, and it is just stupid to dismiss this rich and useful concept because zoomers don’t know it.

The whole point of having a tool such as ocamlformat is to support multiple choices, not to reduce everything to an one-fits-all style. Again, this is not Go. At least we should have an option.

Functional languages tend to have many syntactic forms, even if we cannot just create new ones, like we could with Lisp macros. Again, this is part of the culture.

So, come on.

Author: Ln Gnmn <lngnmn1@gmail.co>

Email: lngnmn2@yahoo.com

Created: 2023-08-08 Tue 18:36

Emacs 29.1.50 (Org mode 9.7-pre)