"OCaml -- first impressions"



I do use ;; quite often, mostly to limit the search scope for syntax errors and of course the REPL.


Going to state the obvious here: that is a serious and avoidable usability flaw.


you mean ;;? in my opinion, it’s actually useful in the toplevel: easy editing of multiline input. as long as ;; is not typed, you can just continue editing. within a module i would agree that it’s not so useful but i find it not serious.

my personal serious usability flaw is the amount of work needed to get pretty-printing of user defined types…


[@@deriving show] is pretty easy to add to your type declarations, IMHO…


i guess you’re right. but when i started i wanted to keep out anything that adds complexity, including syntax extensions or preprocessors. i think it’s odd that one has to use something that generates invisible code in order to get printing. maybe that’s a price to pay for abstraction and strong types?


Given some sort of ad hoc polymorphism (typeclasses, modular implicits, etc.) one can handle printing a bit nicer, and someday, OCaml will have such a thing. However, as thing stand in OCaml, using the deriving ppx is the easy choice.


Even then, though, I don’t know/think that we’ll get printers for things like variant and record types for significantly less cost than we have now. So there will continue to be a place for deriving-like functionality.



Indeed. The question perhaps is, should we bundle certain ppxs with dune by default?


The deriving extensions are included by default in the compiler in Haskell and Rust and are advertised as the recommended way to implement pretty-printing and similar trivial functionality.

We should do a better job at guaranteeing a smooth usage of ppx_deriving on the tooling level and promoting them in official docs.