caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: oleg@okmij.org
To: jun.furuse@gmail.com, caml-list@inria.fr
Subject: Re: [Caml-list] [ANN] ppx_monadic.1.0.2, ppx for monadic do,
Date: Mon, 19 Jan 2015 02:33:03 -0500 (EST)	[thread overview]
Message-ID: <20150119073303.038ECC38BA@www1.g3.pair.com> (raw)
In-Reply-To: <CAAoLEWvdRt=nVRKD7d2fVvxeLujurV4+jMaEkm6VWg+oQHrdoQ@mail.gmail.com>


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

Indeed. One may wish that

        let rec p = e1 in e2

were treated as if it were
        let[@ocaml.let "rec"] p = e1 in e2

and likewise let module. Come to think of it, 'rec! or 'module' are
annotations on let. Then we can generalize so that

        let something p = e1 in e2
(where something is any reserved word or an operator -- something that
cannot be mistaken for a regular identifier) is parsed as if it were

        let[@ocaml.let "something"] p = e1 in e2

The type-checker will complain if it finds the ocaml.let attribute it
does not understand. (Therefore, Typedtree does not have to be changed
-- although one may wish for a specifically letrec node).  Thus we
can define let !, let >>=, let LWP, let struct, let when, let if and all other
potentially useful binding forms.



  reply	other threads:[~2015-01-19  7:33 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     ` oleg [this message]
2015-01-19  8:34       ` [Caml-list] [ANN] ppx_monadic.1.0.2, ppx for monadic do, 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     ` [Caml-list] [ANN] ppx_monadic.1.0.2, ppx for monadic do, pattern Alain Frisch
2015-01-19 21:52       ` 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=20150119073303.038ECC38BA@www1.g3.pair.com \
    --to=oleg@okmij.org \
    --cc=caml-list@inria.fr \
    --cc=jun.furuse@gmail.com \
    /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).