caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Daniel Bünzli" <daniel.buenzli@epfl.ch>
To: list caml-list <caml-list@inria.fr>
Subject: On language extensions (was Re: [Caml-list] global record)
Date: Wed, 19 Jul 2006 21:41:46 +0200	[thread overview]
Message-ID: <67EBB7A9-9294-4783-BF44-E29651EA6E5F@epfl.ch> (raw)
In-Reply-To: <E6F7A586E0A3F94D921755964F6BE006147963@EXCHANGE2.cs.cornell.edu>

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.

This may be seen as a matter of personal taste: it is true that I  
lean towards syntactic regularity, i.e. less syntactic constructs.  
However there is another argument against using extensions: code  
maintenance. You have no guarantee that (1) an extension will not be  
broken by the next version of the language and (2) that the author  
will continue to maintain it.

And by the way, are we guaranteed that two arbitrary camlp4  
extensions will compose or may the order of application matter ?

Cheers,

Daniel

P.S. Even for domain specific languages many things can be done in  
pure ocaml by embedding the dsl in ocaml using meta-programming  
techniques.


  reply	other threads:[~2006-07-19 19:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-19 17:14 [Caml-list] global record Eric Breck
2006-07-19 19:41 ` Daniel Bünzli [this message]
2006-07-19 19:57   ` On language extensions (was Re: [Caml-list] global record) Richard Jones
2006-07-19 20:22     ` Stefano Zacchiroli
2006-07-19 21:33   ` Nicolas Pouillard
2006-07-20  2:57   ` Martin Jambon
2006-07-20  1:12 Eric Breck
2006-07-20  5:16 ` skaller
2006-07-20  6:29   ` Stefano Zacchiroli
2006-07-20  8:57     ` Jean-Marie Gaillourdet
2006-07-20 12:42 ` Bünzli Daniel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=67EBB7A9-9294-4783-BF44-E29651EA6E5F@epfl.ch \
    --to=daniel.buenzli@epfl.ch \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).