28 Apr 2000 prevostjm   » (Apprentice)

O'Caml Hacking

Well, O'Caml 3.00 came out the other day, and it's made me think a bit about doing some more hacking. There's been a lot of discussion on the caml-list lately about the problem of interacting with other peoples' code. In a way, it's the same sort of problem that C has, exacerbated by the fact that you can't easily do things like:

#include <packagename/header.h>

in caml. Instead, the module namespace of a given package is either entirely at the same level as the standard libraries, or is manipulated purely by adding -I library-path to the compile flags.

Needless to say, this makes things kind of messy. The second problem is that there's a wide variety of compilation models used by different people. C has won here by the increasingly common use of autoconf and automake.

What I really want is something akin to the namespace management of Perl. Perl is a mess sometimes, but it's terrifically easy to grab somebody else's package, install it, and try it out. I think that if a language's publicly available libraries are to grow, something like this has to be available.

findlib

Gerd Stolpmann has developed a pretty slick tool called findlib to handle some of this--it will install individual packages with "META" files which describe which libraries need to be linked against in what environments (bytecode, native, threaded, non-threaded) and what other packages are dependencies. You can then write:

ocamlfind ocamlc -package netstring foo.ml bar.ml baz.cma

instead of

ocamlc str.cma -I /usr/lib/ocaml/site-lib/netstring netstring.cma foo.ml bar.ml baz.cma

This is a big win--but not so much until everybody uses it. I've suggested this functionality be folded into the standard O'Caml distribution, but I don't know whether it'll happen.

Makefiles

As for the variety of makefile variants out there, I'm not sure what the right thing to do is--but I'd like to do something. Some people have mentioned that stuff is difficult on Windows and MacOS, and also that on Unix, you often want to build O'Caml and C and various other things. For this latter, makefiles are the only real option.

I've been wondering if a make replacement written in O'Caml might be a good thing. ant from the Jakarta project has provided a pretty cool XML-based make replacement for Java which does nice things. This is definitely preferable to other Java-building solutions. The biggest win is that it's cross-platform.

So, I think I might start work on an O'Caml build tool to help with at the very least pure O'Caml projects.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!