Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] dynamic HTML pages
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-04-09 (18:12)
From: Miles Egan <miles@c...>
Subject: Re: mixing different languages (was: RE: [Caml-list] dynamic HTML pages)
On Tue, 2003-04-08 at 05:28, David Monniaux wrote:
> On Tue, 8 Apr 2003, Mattias Waldau wrote:
> > I use HereDoc by Alain Frisch. I think I use an old version. 
> > It works like JSP. Very simple to use. Based on camlp4.
> This is slightly off-topic, but:
> In the case of dynamic WWW pages, it is often the case that the same
> script or program actually contains code written in several languages:
> HTML, SQL, OCaml/PHP/Perl, XML...

I've used half a dozen different web frameworks in the last several
years and the one thing they all seem to have in common is some kind of
highly dynamic template/expression language.

Most recently I've been using Jakarta Tapestry, which uses ognl
(, a library that evaluates dynamic expressions on
java objects and relies heavily on reflection.  In fact, many of the
more interesting Java projects I've seen recently make heavy use of
reflection or even direct bytecode manipulation to free themselves of
the strictures of the type system and achieve various kinds of

It's hard to imagine doing some of the same things in a language like
OCaml, where runtime metaprogramming is difficult if not impossible. 
How would one implement something like a general-purpose
object-relational mapper, for instance, in OCaml.  Is this just a
fundmental engineering tradeoff of highly typed languages?  Do you have
to sacrifice metaprogramming and runtime introspection for type
inference and type safety?

It seems somewhat ironic to me that large projects in strictly typed
languages often end up building in some kind of meta-object layer and
that all the highly dynamic languages (lisp, python, etc) work hard to
do fancy type inference under the hood?  Perhaps it's just a fact of
life that many complex software systems need to find some common middle
ground with a combination strict type checking and powerful
metaprogramming / introspection features?

Miles Egan <>