caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [ANN] pa_where 0.4 : backward declarations
@ 2008-08-03 18:36 blue storm
  0 siblings, 0 replies; only message in thread
From: blue storm @ 2008-08-03 18:36 UTC (permalink / raw)
  To: caml-list

[-- 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 --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-08-03 18:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-03 18:36 [ANN] pa_where 0.4 : backward declarations blue storm

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).