Version française
Home     About     Download     Resources     Contact us    
Browse thread
Ocaml compiler features
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] Ocaml compiler features
On Monday 15 January 2007 20:23, Martin Jambon wrote:
> OCaml is well-enough designed so that there is no "common" syntax
> extension.

The camlp4-based syntax extension for lazy stream parsing could be considered 
a "common" extension because it is bundled with OCaml and is used by lots of 
people.

I used it in several of the tutorial papers on our site simply because it is 
the most succinct approach to parsing:

  http://www.ffconsultancy.com/free/ocaml/parsing.html
  http://www.ffconsultancy.com/free/ocaml/interpreter.html

It may be superceded by active patterns but I'd still like to see this syntax 
incorporated into OCaml itself.

> The problem is that people use it for a variety of things, and 
> each domain may benefit from particular enhancements of the syntax.

try ... finally is another syntax extension that I think would be welcomed by 
all.

> Either you incorporate all those extensions into the standard syntax,
> which is totally insane, or you consider them just as libraries.

I think there are several camlp4 syntax extensions that are sufficiently 
useful that we would all benefit from them being incorporated into the 
language.

> IMHO the problem is more that writing camlp4 syntax extensions is very
> different from writing everyday OCaml code. In other words,
> it is inaccessible to beginners,

I highly recommend this web page by some guy called Martin Jambon: ;-)

  http://martin.jambon.free.fr/extend-ocaml-syntax.html

Your page is really the only resource on the web that aims to elucidate 
camlp4. It is very good, but I still failed to write the syntax extension 
that I wanted (symbolic expressions as patterns).

> OK, there are many issues to solve, and it may not look as simple as
> advertised, but I am sure it can be done.

All good ideas.

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists