Browse thread
If OCaml were a car
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2007-08-24 (02:55) |
From: | Nathaniel Gray <n8gray@g...> |
Subject: | Re: [Caml-list] If OCaml were a car |
On 8/21/07, Luca de Alfaro <luca@dealfaro.org> wrote: > The only thing about Ocaml I mind, is that it a bit like German is, in that > all the verbs at the end come. And there nothing wrong is, but it for some > strange reading makes, and it strange is that this from France comes. > > I still somewhat puzzled am, at reading: > > let f x = > [humonguous definition 50 lines spanning] > in List.iter f l > > because the only way I make sense of this can, is by first looking at where > f used is, and only then reading its definition. > I much rather write would: > > do List.iter f l > where f x = [humonguous definition] Given the prevalence of List.fold and friends, I think this (the order of arguments) is the biggest obstacle to code comprehension in OCaml. I've even gone so far as to create my own ReList (readable list) library: ReList.iter l (fun x -> [humongous definition] ) As others have mentioned, labels can help as well if that's an option for you, but I find the label system to be a bit intrusive for everyday usage. > Maybe this problem with Ocamlp4 solvable is? I think it already has been done once or twice with camlp4. This and try/finally are popular in camlp4 demos... Cheers, -n8 -- >>>-- Nathaniel Gray -- Caltech Computer Science ------> >>>-- Mojave Project -- http://mojave.cs.caltech.edu -->