From: Martin Jambon <martin1977@laposte.net>
To: "Bünzli Daniel" <daniel.buenzli@epfl.ch>
Cc: Eric Breck <ebreck@cs.cornell.edu>, caml-list@inria.fr
Subject: Camlp4 mysteries (was Re: On language extensions (was Re: [Caml-list] global record))
Date: Thu, 20 Jul 2006 05:40:38 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0607200311150.19078@munge> (raw)
In-Reply-To: <60FD7628-7F4E-4765-88AD-B3AB7DA987D0@epfl.ch>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 2298 bytes --]
On Thu, 20 Jul 2006, Bünzli Daniel wrote:
> I'm sorry to say that but I regard (maybe out of ignorance) camlp4 as very
> low level and brittle tool (not to say hack). An obvious proof of this to me
> is the composition problem which is according to previous messages is not
> solved by camlp4.
In theory the system of quotations allows you to use as many quotation
expanders as you want. Quotations are well delimited and do not interfere
with each other, but look a bit ugly and are restricted to exprs and
patts.
Otherwise it's possible to define well-disciplined syntax extensions.
For example, if each new syntax construct (new rule) is forced to start
with a unique, registered keyword and end with "end", then
different syntax extensions that follow this rule should play well
together.
Deleting or rewriting existing rules would of course be forbidden.
And tools like Declare_once [1] should become builtins.
So if you take my favorite syntax extension (micmatch), you would need to
create a new keyword, let's say "mm":
match "Hello World!" with
/ "Hello"~ blank+ (alnum+ as user) / -> Some user
| _ -> None
could become
mm match "Hello World!" with
mm "Hello"~ blank+ (alnum+ as user) end -> Some user
| _ -> None
end
To the OCaml development team:
Would such a convention make sense?
Could there be special restricted EXTEND statement that only accepts that
kind of rules, and registers the keywords to avoid unexpected clashes
between extensions that try to use the same leading keyword?
It would be really nice to have official guidelines on how to develop
clean syntax extensions, if not automatic enforcement.
That's all I can say, I don't have time to spend playing with the
new Camlp4 or trying to understand what MetaOCaml is about.
Any official word about the metaprogramming issues in OCaml would be
appreciated!
I am sorry to say that, but there is way too much mystery floating around
Camlp4. A web page that presents a roadmap for the development of OCaml
language and tools including Camlp4 would be much appreciated.
Martin
[1] Declare_once: look for it at http://www.yl.is.s.u-tokyo.ac.jp/~oiwa/en_US.ISO-8859-1/pub/caml/regexp-pp-1.0.0/README.match-regexp
--
Martin Jambon, PhD
http://martin.jambon.free.fr
next prev parent reply other threads:[~2006-07-20 20:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-20 1:12 On language extensions (was Re: [Caml-list] global record) 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
2006-07-20 12:40 ` Martin Jambon [this message]
2006-07-20 23:38 ` Camlp4 mysteries (was Re: On language extensions (was Re: [Caml-list] global record)) Alain Frisch
2006-07-21 0:11 ` Martin Jambon
2006-07-21 0:29 ` skaller
2006-07-21 0:31 ` Martin Jambon
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=Pine.LNX.4.64.0607200311150.19078@munge \
--to=martin1977@laposte.net \
--cc=caml-list@inria.fr \
--cc=daniel.buenzli@epfl.ch \
--cc=ebreck@cs.cornell.edu \
/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