On Sun, May 27, 2012 at 8:04 PM, Daniel Bünzli <daniel.buenzli@erratique.ch> wrote:
camlp4 is one of the (conceptually) ugliest component of the OCaml system.
Pre-processors in general are a wrong solution to a real problem;
meta-programming facilities should be part of the core language and
play by its scoping rules, they should not be layered on top of it.

I subscribe. At the present state OCaml, which is otherwise an almost perfect language, needs some tool, I mean any tool, to accomplish simple metaprogramming tasks.

Camlp4, which could be an awful or an amazing tool, is known by an inner circle of wizards, and the activity of creating a new syntax extension is a... sorcery for initiates only.

My experience of average and maybe dumb OCaml programmer: last week I tried to write a simple ORM, something resembling the Django ORM and, after some (random) trial and error, I simply gave up. I have started thinking to use cpp as a preprocessor to create very simple "templates", which is awful, but the only alternative I have is to define the ORM classes in something like XML, parse them and generate OCaml sources.

It's definitively a lose-lose game.


--
Paolo