caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alain Frisch <alain@frisch.fr>
To: Jun Furuse <jun.furuse@gmail.com>,
	oleg@okmij.org,  caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] [ANN] ppx_monadic.1.0.2, ppx for monadic do, pattern
Date: Mon, 19 Jan 2015 09:56:54 +0100	[thread overview]
Message-ID: <54BCC6D6.6020702@frisch.fr> (raw)
In-Reply-To: <CAAoLEWvdRt=nVRKD7d2fVvxeLujurV4+jMaEkm6VWg+oQHrdoQ@mail.gmail.com>

On 01/18/2015 03:47 PM, Jun Furuse wrote:
> Thanks,
>
> let! is not valid in the vanilla syntax therefore I guess you have
> patched the compiler.
>
> Current OCaml syntax has shortage of pattern binding expression and
> only usable is let%xxx p = e in which is a bit pain for ppx writers.

If it's a pain, it's rather for users of ppx, no?

Providing "alternative" forms of existing constructs (i.e. forms that 
look syntactically similar to these constructs) to be interpreted before 
they reach the type-checker, is indeed what extension nodes [%foo ...] 
were designed for.  For expression constructs starting with a keyword, 
the short form KEYWORD%foo ... makes the use of extension nodes very 
cheap syntactically.

I can appreciate that authors of tools that requires special syntactic 
support would love to have their new forms look completely native to 
users, but the counter-argument can be made that keeping an explicit 
syntax (through the '%' character) for features that are not part of the 
official language is a good property.  (Camlp4/campl5 are still 
available for people who want to play with the concrete syntax.)


With the short form, an alternative binding construct can be as short as:

  let%L p = e in ....

I'm not suggesting to reserve one-letter extension identifiers for 
specific projects, but each tool could let the user choose explicitly 
which letter to use:


   [%%Project1 alt_id = "L"]
   [%%Project2 alt_id = "A"]
   ...
   ...
     let%L p1 = e1 in ....
     let%A p2 = e2 in ....



Alain

  parent reply	other threads:[~2015-01-19  8:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-13 14:23 [Caml-list] [ANN] ppx_monadic.1.0.2, ppx for monadic do, pattern guards and monadic comprehension Jun Furuse
2015-01-14  8:40 ` [Caml-list] [ANN] ppx_monadic.1.0.2, ppx for monadic do, pattern oleg
2015-01-18 14:47   ` Jun Furuse
2015-01-19  7:33     ` [Caml-list] [ANN] ppx_monadic.1.0.2, ppx for monadic do, oleg
2015-01-19  8:34       ` Alain Frisch
2015-01-19  9:06         ` Gabriel Scherer
2015-01-19  9:40           ` Alain Frisch
2015-01-19 16:10             ` Jeremy Yallop
2015-01-19  8:56     ` Alain Frisch [this message]
2015-01-19 21:52       ` [Caml-list] [ANN] ppx_monadic.1.0.2, ppx for monadic do, pattern Drup
2015-01-20  3:53         ` Jun Furuse

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=54BCC6D6.6020702@frisch.fr \
    --to=alain@frisch.fr \
    --cc=caml-list@inria.fr \
    --cc=jun.furuse@gmail.com \
    --cc=oleg@okmij.org \
    /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).