caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "blue storm" <bluestorm.dylc@gmail.com>
To: caml-list <caml-list@inria.fr>
Subject: [ANN] pa_where 0.4 : backward declarations
Date: Sun, 3 Aug 2008 20:36:28 +0200	[thread overview]
Message-ID: <527cf6bc0808031136k37887c02k6105b26b6adf5aaf@mail.gmail.com> (raw)

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

    <mfp> breaking caml-list's silence for anything else than
         some deep typing issue feels wrong :-P

Let's make him feel wrong.

mfp and I are pleased to announce the first public release of
pa_where, a camlp4 extension enabling backward declarations. The
"where" keyword, available in the revised syntax, and one of the
truly missed Caml-light friends, is back.

The syntax, however, is slightly different from the usual one :
"where" should be followed by another declarative keyword, such
as "let" : a where let a = b

It is possible to use the "where let" form inside expressions,
and the "where val" form at toplevel (structure items). Having
a different syntaxic form for toplevel and local declarations is
not the classical syntax standard, but was needed for
disambiguation issues.

It is however possible to use the good old "where a = b" syntax :
in absence of any declarative keyword, the "let" keyword is used
as default.

The revised syntax "where" is restricted because of the "dangling
and" issue. pa_where has no such restriction (what's one more
ambiguity in the classical syntax anyway ?). Here are the two
ambiguous cases :
   a where b where c => (a where b) where c
   let a = b where c and d => let a = (b where c and d)

It would be possible to extend the backward declarations to other
constructions such as "where module" or "where type". If you see
any use for it, do not hesitate to ask for the feature or send
a patch.

The final syntax, wich I think is a good compromise, is the
result of a debate on the #ocaml IRC channel (Freenode). If you
are about to write a syntax extension yourself, you should really
consider discussing your syntax considerations there (or maybe on
the mailing-list ?) : it is amazing how helpful such a debate can
be on a so subjective question.

Thanks in advance for any testing, comment, criticism, request or
patch.


URL : http://bluestorm.info/camlp4/pa_where/list.php

Available archives (test and META files included) :
- http://bluestorm.info/camlp4/pa_where/pa_where-0.4-.tar.gz
- http://bluestorm.info/camlp4/pa_where/pa_where-0.4-.zip

Highlighted HTML source for online reading :
- http://bluestorm.info/camlp4/pa_where/pa_where.ml.html

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

                 reply	other threads:[~2008-08-03 18:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=527cf6bc0808031136k37887c02k6105b26b6adf5aaf@mail.gmail.com \
    --to=bluestorm.dylc@gmail.com \
    --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).