caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Nicolas Pouillard" <nicolas.pouillard@inria.fr>
To: "Daniel Bünzli" <daniel.buenzli@epfl.ch>
Cc: "list caml-list" <caml-list@inria.fr>
Subject: Re: On language extensions (was Re: [Caml-list] global record)
Date: Wed, 19 Jul 2006 23:33:59 +0200	[thread overview]
Message-ID: <cd67f63a0607191433g3862be91td1b8c667d0441e99@mail.gmail.com> (raw)
In-Reply-To: <67EBB7A9-9294-4783-BF44-E29651EA6E5F@epfl.ch>

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

  parent reply	other threads:[~2006-07-19 21:34 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 ` On language extensions (was Re: [Caml-list] global record) Daniel Bünzli
2006-07-19 19:57   ` Richard Jones
2006-07-19 20:22     ` Stefano Zacchiroli
2006-07-19 21:33   ` Nicolas Pouillard [this message]
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=cd67f63a0607191433g3862be91td1b8c667d0441e99@mail.gmail.com \
    --to=nicolas.pouillard@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=daniel.buenzli@epfl.ch \
    /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).