English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Compiler feature - useful or not?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-11-15 (13:48)
From: Jacques Carette <carette@m...>
Subject: Re: [Caml-list] Compiler feature - useful or not?
Vincent Hanquez wrote:
> On Thu, Nov 15, 2007 at 12:23:25AM -0600, Edgar Friendly wrote:
>> But camlp4 holds back real development of the OCaml Community
>> by dividing the language into incompatible splinter dialects or forcing
>> us to code in pure OCaml which has little sugar.
> I'm glad that some people feels the same way about camlp4 !
> this is really sad, that people thinks camlp4 is a great idea ...

Come now, be fair, camlp4 has both advantages and disadvantages. 

- Allows you to *prove* that some syntactic sugar can make a big 
difference in writing code.  This is 2 orders of magnitude more 
effective in convincing people than just arguing for it (on caml-list, 
in person, whatever).  Some extensions become popular because they have 
proved themselves this way.  What is lacking is a process by which these 
can be integrated into the language.
- Allows you to show that some boilerplate code can be eliminated.  This 
is even better than the above, because every such instance is really a 
research problem in disguise: how does one design a type system that can 
show that this purely syntactic manipulation is correct?
- Allows you to embed a DSL into OCaml with quite a bit of ease and 
freedom.  One of the reasons to use campl4 instead of OCaml directly is 
that for embedding DSLs, it is very frequent that lazyness is needed, 
something less comfortable in OCaml.

- It splinters the language into dialects.
- It makes errors in the source code of user programs difficult to track 
[anyone who has ever debugged camlp4-enabled programs have seen this]
- Bugs in the extension itself are fantastically difficult to debug.

Personally, I think the best situation would be if camlp4 were 
unnecessary.  But there is a lot of PL research to be done before that's 
possible.  And in the meantime, the extensions that people choose to 
write in camlp4 communicate very loudly what users of OCaml really want 
[as they are willing to put in serious effort into ``adapting'' the 
language to their needs]; when I used to be a language developer (on 
another system and, sadly, before I got proper training to do so), I 
weighted user requests by how much effort the user had put into the 
request.  This annoyed loudmouths and pleased hardcore users, which 
seemed fine with me.