Browse thread
Re: [Caml-list] global record
-
Eric Breck
-
Daniel_Bünzli
- Richard Jones
- Nicolas Pouillard
- Martin Jambon
-
Daniel_Bünzli
[
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: | 2006-07-19 (21:34) |
From: | Nicolas Pouillard <nicolas.pouillard@i...> |
Subject: | Re: On language extensions (was Re: [Caml-list] global record) |
On 7/19/06, Daniel Bünzli <daniel.buenzli@epfl.ch> wrote: > Hello, > > I would like to issue a warning about everybody rolling its own > syntax extension to suit its taste. > > Contrary to lisp's macros, each syntax extension is syntactically a > new language. Hence not only do we need to learn a new semantics but > also a new syntax. If I have to read someone else's code I want to > read caml code and not caml code augmented with the author's > syntactic obsessions. > > In code readability, there is a trade-off between succinctness and > syntactic regularity. Camlp4 extensions increase the former but > decrease the latter. For me camlp4's usage should be limited to real > domain specific languages (e.g. like coq does) and research, it > should not be used to increase ocaml's succinctness. > [...] Camlp4 is "just" a pre-processor, you always can unsugar your code and take back a plain ocaml code. This can be done to get rid of a no more maintained extension, or to understand some code that use such an extension. $ camlp4o pa_foo.cmo pa_bar.cmo pr_o.cmo input.ml -o output.ml You can now read output.ml as a plain ocaml file. Thus, IMHO, people can add syntax extensions since we have an easy way to get rid of them. -- Nicolas Pouillard