caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Hongbo Zhang <bobzhang1988@gmail.com>
To: Alain Frisch <alain@frisch.fr>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Re: Syntax extensions without Camlp4
Date: Wed, 30 May 2012 10:14:43 -0400	[thread overview]
Message-ID: <4FC62B53.20504@gmail.com> (raw)
In-Reply-To: <4FC61595.6070009@frisch.fr>

[-- Attachment #1: Type: text/plain, Size: 4182 bytes --]

On 5/30/12 8:41 AM, Alain Frisch wrote:
Hi Alain,
    Thanks for your message.
    I am building a framework on top of camlp4, which provides those 
features you mentioned in the post in a flexible way. It needs to be 
polished. So far, writing generic plugins is really easy. (generic 
printing, comparison, lift filter, etc , each about 20 lines).
    The conclusion below is based on my observation and experiences. 
Feel free to correct me if I am wrong.

    1. Why camlp4 is buggy?
    The main buggy part is its parsing technology.  So is its parsing 
technology a bad idea? No, it's really convenient for rapid ad-hoc 
prototyping, suppose you don't need write a lexer, and its parser simply 
works in the toplevel, the parser itself it really shorter even compared 
with menhir, if you refactor your parser part.
    The main buggy part lies in camlp4of, which is not tested at all. 
it's easy to test camlp4o, camlp4rf. There's large code base written 
both in camlp4o and camlp4rf. So in my opinion, we should just *drop 
camlp4of*, unless it's really heavily tested. *camlp4rf* is a good 
syntax, in my experience, it just took me one day to get used to, and I 
wrote my daily caml code in revised syntax. It's not hard to learn. It's 
much easier compared with the complexity of camlp4ast or ocamlast. So, 
IMHO, we should just advise camlp4 developers to use revised syntax. It 
would be nice if Daniel would write some articles how internal parser 
mechanism works. Revised syntax just catch up with the trunk, it should 
not be exactly the same, this gives the caml develop team enough freedom 
to introducing new constructs(monad support, etc)

   2. About the proposal.
     There are mainly 2 pieces. About the hook 
Parsetree.structure->Parsetree. structure, given that camlp4 already 
imports Parsetree, it's really trivial to
add another hook after camlp4astdump2ocamlast.
     The other piece about introducing attribute grammar, whcich is 
orthogonal to camlp4, IMHO.
     It's still nontrivial to write a robust Parsetree.structure -> 
Parsetree.structure,  it would be nice if we could provide a quotation 
syntax for Parsetree.types. I would contribute if there was some funding 
support.

  3. Extending the syntax.
     It is really nice to extend your syntax for ad-hoc hacking. Your 
nice software ulex, and bitstring is a good example. It could be even 
better to just introduce a new quotation for robustness.

     But I am against mutating syntax for personal taste. (try finally, 
monad syntax), those improvement should be in the trunk.

Many Thanks
> On 05/27/2012 06:53 PM, Hongbo Zhang wrote:
>> Well, I don't think it's good to downplay camlp4. The problem is we need
>> more documentation and more tests.
>
> (The new) Camlp4 has been here for several years.  Documentation and 
> tests are still lagging behind.  Nevertheless, it burns a 
> non-negligible fraction of the total resource spent by maintainers on 
> OCaml (fixing bugs, struggling with camlp4 to take new language 
> features into account).
>
> In addition, there is a growing consensus that the most common uses of 
> camlp4 (such as code generation driven by type declaration) might be 
> based on a much simpler approach, and this would actually have 
> advantages for the end-users (like not changing the concrete syntax)
> and for developers (much less information to grasp in order to write 
> such an extension).
>
> Coq is one of the few examples of a big project that relies on other 
> aspects of camlp4 (e.g. its parsing framework with extensible 
> grammars).  As far as I know, it also still works with camlp5, which 
> is actively maintained, and I don't believe the Coq guys enjoy so much 
> maintaining support for both camlp4 and campl5.
>
> All that considered, and this is only a personal opinion: I don't see 
> compelling arguments to continue investing efforts in camlp4 itself 
> (at least, for the core OCaml team) and I believe it is a good time to 
> start considering a (medium-term) future of OCaml without camlp4.  Of 
> course, alternative solutions need to be developed and streamlined 
> before killing camlp4 is even considered.
>
>
> Alain


[-- Attachment #2: Type: text/html, Size: 9454 bytes --]

  parent reply	other threads:[~2012-05-30 14:14 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-27 15:06 [Caml-list] " Alexandre Pilkiewicz
2012-05-27 16:53 ` [Caml-list] " Hongbo Zhang
2012-05-27 18:04   ` Daniel Bünzli
2012-05-27 18:18     ` Hongbo Zhang
2012-05-27 19:01       ` Daniel Bünzli
2012-05-27 22:43         ` Wojciech Meyer
2012-05-28  9:35           ` Daniel Bünzli
2012-05-28  9:59             ` Gabriel Scherer
2012-05-30 14:45               ` Hongbo Zhang
2012-05-28 11:17             ` Wojciech Meyer
2012-05-28 15:52             ` Jeffrey Scofield
2012-05-27 18:19     ` Hongbo Zhang
2012-05-28  8:17     ` Paolo Donadeo
2012-05-30 12:41   ` Alain Frisch
2012-05-30 13:18     ` Markus Mottl
2012-05-30 13:37     ` Dan Bensen
2012-05-30 14:16       ` Hongbo Zhang
2012-05-30 14:23         ` Paolo Donadeo
     [not found]           ` <20120531081913.GA26742@securactive.lan>
2012-05-31 12:26             ` Paolo Donadeo
2012-05-31 12:38               ` Anil Madhavapeddy
2012-05-31 12:40                 ` Anil Madhavapeddy
2012-05-31 12:46                   ` Yaron Minsky
2012-05-31 12:47                   ` Gabriel Scherer
2012-05-31 22:08                 ` Paolo Donadeo
2012-05-30 14:14     ` Hongbo Zhang [this message]
2012-05-31 12:59       ` Alain Frisch
2012-05-31 13:21         ` Dmitry Grebeniuk
2012-05-31 14:30           ` Daniel Bünzli
2012-05-31 16:01         ` bob zhang
2012-05-31 17:28           ` Gerd Stolpmann
2012-05-31 18:03             ` Wojciech Meyer
2012-05-31 18:32               ` Gerd Stolpmann
2012-05-31 18:32             ` Hongbo Zhang

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=4FC62B53.20504@gmail.com \
    --to=bobzhang1988@gmail.com \
    --cc=alain@frisch.fr \
    --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).