7

I am about to start a new project and I cannot decide if I should pick OCaml or Lisp for the project. My main concern is about the difference of productivity — if any.

I program OCaml since 1998 and, while I neither tried to measure this precisely nor to even define precisely what the productivity I would like to measure is, I am pretty confident that I am more productive with OCaml than I am with more classical languages I know, as C or Python. I think so, because the compiler is so good at catching my errors, that only the smart bugs make it to the final program—but these are usually easy to find, like some logic piece being semi-obviously wrong or system resources inappropriately manipulated. I never invested in learning the debugger of OCaml — which by the way can go backwards in the time—because I had never felt I needed using it. The language has a module system allowing generalisation of structures by means of functors and a preprocessor camlp4 which can be used to extend the language, like implementing automatic serialisation of values.

This is of course something that Lisp has not—but I tried Slime in Emacs, and it looks to include an all-mighty debugger and code explorer. But Lisp has macros.

Unfortunately, my knowledge in Lisp is almost zero—I toyed around with it about one afternoon—and I am therefore unable to compare macros with camlp4. To me, it seems that:

  • Lisp macros are much easier to write than camlp4 extensions.
  • Lisp macros are much easier to use as modules or camlp4 extensions. Functors, when used to implement a functionality similar to traits are quite clumsy, verbose, and require odd-looking idiosyncratic invocations: on the other side, Lisp macros just look like anything else in Lisp (S-expressions).
  • Lisp macros do not raise an engineering problem, they belong to a package, dot. Functors do raise engineering problems because type names receive aliases, which is puzzling.

(As a side note, it looks to me that Lisp is easier to get started with than OCaml is, at least for the bunch of quantum physicists wanting to join the project.)

Can anyone compare the incidence on productivity of OCaml and Lisp (pick the one you want)?

2
  • 2
    I program OCaml since 1998 and... -- That's probably the deciding factor, unless this is a "learn a new language" exercise, or macros are an integral and necessary part of your project. Most of the time, you won't need macros (always prefer higher-order functions instead), unless you want to define language syntax. Jan 25, 2014 at 3:27
  • @RobertHarvey most of the time, you won't need macros, always prefer higher-order functions — That's quite a fair argument! Macros look like the best available tool when it comes to write data-interfaces (both DB or GUI). But well, that is not all of the program!
    – user40989
    Jan 25, 2014 at 10:14

0

Browse other questions tagged or ask your own question.