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
[Caml-list] Web Development with OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-07-10 (09:38)
From: Alain Frisch <frisch@c...>
Subject: Re: [Caml-list] Web Development with OCaml
On Tue, 10 Jul 2001, Tom Hirschowitz wrote:

> Hi. You may have a look at the "making of" Alain Frisch's page.
> http://www.eleves.ens.fr:8080/home/frisch/realis.html

Well, this is largely out-dated, and is only about producing static
html pages. The method also works for dynamic content, but the issues
are quite different (Jimmie asked anout "web development", which involves
issues as data persistency, query to databases, application structure
to handle connections; html layout of produced pages is not a central

I've used several different system to build my homepage. The idea was
always to factor out from the documents what can be factorized (design of
the site, automatic generation of indexes).  Now I use my HereDoc
preprocessor (http://www.eleves.ens.fr:8080/home/frisch/soft), which has
system of templates (documents with holes that can be filled with the
result of Caml expressions); HereDoc has nothing specific to html. The
source for my homepage can be found there:  

As I said above, web development is more than producing html pages.
OCaml has already most of the library needed:
- to process CGI arguments: Netstring's Cgi module does the job
- to handle connection to databases, there are several bindings
  to access PostgreSQL, MySQL, Oracle,.. databases
- XML parser: Pxp
- string manipulation and regular expressions à la Perl: Str, Pcre
- this may be useful too: http://www.eleves.ens.fr:8080/home/mine/ocamlhtml
- the OCaml Link Database is a good example of web application written
  is OCaml

In addition to my static homepage, I use OCaml for almost all the dynamic
content (and automatic generation of indexes) for the web server I
administrate (www.eleves.ens.fr:8080). I also used OCaml to prototype
quickly a semi-industrial web site which featured, among other things,
many different CGI forms, cookies, connections, upload and validation of
XML document, dynamic html generation from templates. It was a real
pleasure to use OCaml, and made it possible to develop all these things in
a few hours (the main, actually the only, problem was the lack of OCaml
developpers to maintain the code).

So yes, I believe that OCaml is a great tool for web development.
It would be great to have some integration between Cgi,
regexp manipulation, document generation, and a general application
framework dealing with persistency and database connections.
With Camlp4, it should be possible to define a comfortable 
semi-specialized syntax. Does anyone have the experience to design
such a framework, and want to launch a project ?

> Jimmie Houchin writes:
>  > Hello,
>  > 
>  > I am new to OCaml and Functional programming in general. I am building a
>  > website and would like to know if OCaml is being used for web development.

Alain Frisch

Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr